import type { IResourceController } from "@sammo/game_logic"; import type { City } from "@sammo/game_logic/src/City.js"; import type { CityID, GeneralID, NationID, SquadID } from "@sammo/game_logic/src/defs.js"; import type { IGeneralEntity } from "@sammo/game_logic/src/Entity/GeneralEntity.js"; import type { ICityEntity, ValidEntityType } from "@sammo/game_logic/src/Entity/index.js"; import type { INationEntity } from "@sammo/game_logic/src/Entity/NationEntity.js"; import type { ReservedTurn } from "@sammo/game_logic/src/defs.js"; import type { ISquadEntity } from "@sammo/game_logic/src/Entity/SquadEntity.js"; import type { GameEnv } from "@sammo/game_logic/src/GameEnv.js"; import { General } from "@sammo/game_logic/src/General.js"; import type { LazyEntityUpdater } from "@sammo/game_logic/src/LazyEntityUpdater.js"; import type { Nation } from "@sammo/game_logic/src/Nation.js"; import type { Squad } from "@sammo/game_logic/src/Squad.js"; import { insertItemAtArrayLike, NotYetImplemented } from "@sammo/util"; import Denque from "denque"; import type { Mongoose } from "mongoose"; type ChangeType = "insert" | "update" | "delete"; //TODO: Implement! export class ResourceController implements IResourceController{ constructor( private readonly db: Mongoose ) { } private _nation: Map = new Map(); private _city: Map = new Map(); private _squad: Map = new Map(); private _general: Map = new Map(); //내부적으로 turnTime asc, id asc로 동작하는 PriorityQueue private _generalByTurnTime = new Denque(); private changes = { Nation: new Map(), City: new Map(), Squad: new Map(), General: new Map(), GameEnv: new Map(), } as const satisfies Record]>>; nation(id: NationID): Nation | undefined { throw new NotYetImplemented(); } city(id: CityID): City | undefined { throw new NotYetImplemented(); } squad(id: SquadID, nation: NationID): Squad | undefined { throw new NotYetImplemented(); } general(id: GeneralID): General | undefined { throw new NotYetImplemented(); } peekGeneralTurnTimeQueue(): General | undefined { return this._generalByTurnTime.peekFront(); } popGeneralTurnTimeQueue(): General | undefined { return this._generalByTurnTime.shift(); } insertGeneralTurnTimeQueue(general: General, maybeTail: boolean): void { insertItemAtArrayLike(this._generalByTurnTime, general, (a, b)=>a.compareTurnTime(b), maybeTail); } gameEnv(): GameEnv { throw new NotYetImplemented(); } allNations(): Map { throw new NotYetImplemented(); } allCities(): Map { throw new NotYetImplemented(); } allCitiesByNation(): Map> { throw new NotYetImplemented(); } allSquads(): Map> { throw new NotYetImplemented(); } allGenerals(): Map { throw new NotYetImplemented(); } generalByNation(id: NationID): Map { throw new NotYetImplemented(); } generalByCity(id: CityID, nationID?: NationID): Map { throw new NotYetImplemented(); } generalBySquad(id: SquadID): Map { throw new NotYetImplemented(); } cityByNation(id: NationID): Map { throw new NotYetImplemented(); } squadByNation(id: NationID): Map { throw new NotYetImplemented(); } //----Insert, Update, Delete reserveUpdate(entity: LazyEntityUpdater): void { throw new NotYetImplemented(); } reserveDelete(entity: LazyEntityUpdater): void { throw new NotYetImplemented(); } reserveInsert(entity: LazyEntityUpdater): void { throw new NotYetImplemented(); } createGeneral(raw: IGeneralEntity): General { throw new NotYetImplemented(); } createNation(raw: INationEntity): Nation { throw new NotYetImplemented(); } createSquad(raw: ISquadEntity): Squad { throw new NotYetImplemented(); } _getAllChanges(): Record]>> { return this.changes; } //---- DB 접근 --- getReservedTurn(general: General): Promise { throw new NotYetImplemented(); } nationReservedTurn(general: General): Promise { throw new NotYetImplemented(); } resetAndFill(): Promise { throw new NotYetImplemented(); } saveAll(): Promise { throw new NotYetImplemented(); } }