#include <zephyr/kernel.h>
#include <zephyr/logging/log.h>
#include <game_mgmt.h>

LOG_MODULE_REGISTER(game_mgmt, CONFIG_GAME_MGMT_LOG_LEVEL);

static sys_state_t current_state = SYS_STATE_IDLE;
static uint64_t current_game_id = 0;

int game_mgmt_init(void)
{
    LOG_INF("Game Management initialized (State: IDLE)");
    return 0;
}

void game_mgmt_set_state(sys_state_t state)
{
    if (current_state == state) return;
    LOG_INF("State Change: %d -> %d", current_state, state);
    current_state = state;
    /* Future: Trigger events based on state (e.g. start/stop beacon) */
}

sys_state_t game_mgmt_get_state(void) { return current_state; }

void game_mgmt_set_game_id(uint64_t id) {
    if (current_game_id == id) return;
    current_game_id = id;
    LOG_INF("Game ID updated: 0x%llx", id);
}

uint64_t game_mgmt_get_game_id(void) { return current_game_id; }