import type { FullGame, FullWall } from "./games/games";

interface Player {
    name: string;
    points: number;
}

const baseRoute = "/connected/display/running";
let players: Player[] = $state([]);
let currentPlayer: string = $state("");
// eslint-disable-next-line prefer-const
let game: FullGame | undefined = undefined;
let gameIndex: number = -1;
let wall: FullWall | undefined = undefined;
let wallIndex: number = -1;

export default {
    get players(): Player[] {
        return players;
    },
    // eslint-disable-next-line @typescript-eslint/no-explicit-any
    set players(newPlayers: any) {
        players = newPlayers;
    },
    get currentPlayer(): string {
        return currentPlayer;
    },
    set currentPlayer(str: string) {
        currentPlayer = str;
    },
    baseRoute,
    get game(): FullGame | undefined {
        return game;
    },
    // eslint-disable-next-line @typescript-eslint/no-explicit-any
    set game(newGame: any) {
        game = newGame;
    },
    get gameIndex() {
        return gameIndex;
    },
    set gameIndex(i: number) {
        gameIndex = i;
    },
    get wall(): FullWall | undefined {
        return wall;
    },
    // eslint-disable-next-line @typescript-eslint/no-explicit-any
    set wall(newWall: any) {
        wall = newWall;
    },
    get wallIndex() {
        return wallIndex;
    },
    set wallIndex(i: number) {
        wallIndex = i;
    }
};
