#ifndef SIMULATION_WORLD_H
#define SIMULATION_WORLD_H

#include <stdlib.h>

#include "shared/game_world.h"
#include "player.h"
#include "command.h"

typedef enum {
    Simulation_Match_State_Waiting_To_Start,
    Simulation_Match_State_Counting_Down,
    Simulation_Match_State_Active,
    Simulation_Match_State_Ended,
} Simulation_Match_State;

typedef struct {
    uint64_t tick;

    Game_World *game_world;

    Simulation_Match_State match_state;

    Simulation_Player *players;
    uint16_t max_players;

    Simulation_Command *commands;
    uint16_t command_count;
    uint16_t max_commands;
} Simulation_World;

Simulation_World simulation_create_world(uint32_t seed, uint8_t max_players, uint16_t width, uint16_t height);
void simulation_destroy_world(Simulation_World *simulation_world);

void simulation_world_tick(Simulation_World *simulation_world);

bool simulation_world_enqueue_command(Simulation_World *simulation_world, Simulation_Command command);

uint16_t simulation_world_amount_of_active_players(Simulation_World *simulation_world);

#endif