import { defineStore } from 'pinia' import { AppStoreEnum } from '#lib/enums' import type { CasinoGameItem, GameItem, GameOptions } from '#lib/types' export interface GamesStore { lastGame: GameOptions | undefined lastURL?: string allGames?: GameItem[] allCasinoGames?: CasinoGameItem[] } export const useGamesStore = defineStore(AppStoreEnum.Games, { state: (): GamesStore => ({ lastGame: undefined, lastURL: '', allGames: [], allCasinoGames: [], }), persist: false, actions: { setAllCasinoGames(value: CasinoGameItem[]): void { this.allCasinoGames = value }, setAllGames(value: GameItem[]): void { this.allGames = value }, setLastGame(game: GameOptions): void { this.lastGame = game }, getLastGame(): GameOptions | undefined { return this.lastGame }, setLastURL(url: string): void { this.lastURL = url }, getLastURL(): string { return this.lastURL! }, reset() { this.lastGame = undefined this.lastURL = '' }, }, })