import type { RoomDef } from "@psx/shared";
import { CELLAR } from "./cellar.js";
import { CORRIDOR } from "./corridor.js";
import { FOYER } from "./foyer.js";
import { GALLERY } from "./gallery.js";
import { INTERVIEW } from "./interview.js";
import { KITCHEN } from "./kitchen.js";
import { LOUNGE } from "./lounge.js";
import { OFFICE } from "./office.js";
import { STUDY } from "./study.js";

/**
 * Ashgrove Precinct — Level 1 building (all cast NPCs).
 *
 *   Lobby (Ellis) ⇄ Lounge (Kane)
 *        ↓
 *   Squad Hall ⇄ Office (Reyes) ⇄ Interview (Voss)
 *        ↓              ↓ (brass key)
 *   Corridor → Records (Hale)   Break Room → Vault (Marrow)
 */
export const ROOM_CATALOGUE: ReadonlyMap<string, RoomDef> = new Map(
  [FOYER, GALLERY, CORRIDOR, STUDY, KITCHEN, CELLAR, OFFICE, INTERVIEW, LOUNGE].map(
    (room) => [room.id, room],
  ),
);

export const START_ROOM = FOYER;
export const START_SPAWN = "start";

export function getRoom(id: string): RoomDef | undefined {
  return ROOM_CATALOGUE.get(id);
}

export {
  FOYER,
  GALLERY,
  CORRIDOR,
  STUDY,
  KITCHEN,
  CELLAR,
  OFFICE,
  INTERVIEW,
  LOUNGE,
};
