#pragma once

namespace command {
class params {
public:
  params();

  [[nodiscard]] int size() const;
  [[nodiscard]] const char* get(int index) const;
  [[nodiscard]] std::string join(int index) const;

  const char* operator[](const int index) const { return this->get(index); }

private:
  int nesting_;
};

class params_sv {
public:
  params_sv();

  [[nodiscard]] int size() const;
  [[nodiscard]] const char* get(int index) const;
  [[nodiscard]] std::string join(int index) const;

  const char* operator[](const int index) const { return this->get(index); }

private:
  int nesting_;
};

void add_raw(const char* name, void (*callback)(), int is_key = 0);
void add(const char* name, const std::function<void(const params&)>& callback);
void add(const char* name, const std::function<void()>& callback);

void add_sv(const char* name,
            std::function<void(game::gentity_s*, const params_sv&)> callback);

void execute(std::string command, bool sync = false);
} // namespace command
