#ifndef GAME_SESSION_H
#define GAME_SESSION_H

#include <stdint.h>
#include <stdbool.h>

#include "shared/squeue.h"

#include "simulation/simulation_world.h"
#include "simulation/input.h"
#include "simulation/player.h"

typedef struct {
    bool active;

    Simulation_Game_Input input;
} Game_Session_Player;

typedef struct {
    uint32_t seed;

    bool online;
    
    uint16_t level_width;
    uint16_t level_height;
    
    double tickrate;

    uint8_t max_players;
    
    // ..
} Game_Session_Settings;

typedef struct {
    Game_Session_Settings settings;
    
    Game_Session_Player *players;
    Game_Session_Player *players_prev;

    Simulation_World simulation_world;
} Game_Session;

void game_session_init(Game_Session *session, Game_Session_Settings settings);
void game_session_dispose(Game_Session *session);

void game_session_init_default_settings(bool online, Game_Session_Settings *out_settings);

void game_session_tick(Game_Session *session);

uint16_t game_session_get_amount_of_active_players(Game_Session *session);

bool game_session_create_player(Game_Session *session, uint16_t *out_player_index);
void game_session_destroy_player(Game_Session *session, uint16_t player_index);

bool game_session_set_player_input(Game_Session *session, uint16_t player_index, Simulation_Game_Input input);


#endif