#pragma once

#include <vector>

#include "fmt/format.h"

constexpr auto SG_TERMINATOR = '\r';

class CSGMessageBuilder
{
public:
    CSGMessageBuilder& Command(const std::string& cmd)
    {
        m_vecToken.clear(); // Start fresh
        m_vecToken.push_back(cmd);
        return *this;
    }

    CSGMessageBuilder& AddArg(const std::string& arg)
    {
        m_vecToken.push_back(arg);
        return *this;
    }

    template <typename T>
    CSGMessageBuilder& AddArg(T value)
    {
        m_vecToken.push_back(fmt::format("{}", value));
        return *this;
    }

    std::string Build() const
    {
        return fmt::format("{}{}", fmt::join(m_vecToken, ","), SG_TERMINATOR);
    }

private:
    std::vector<std::string> m_vecToken;
};
