/**
 * Core interfaces for the interactive fiction world model
 */

export interface Room {
  id: string;
  name: string;
  description: string;
  exits: Exit[];
  objects: string[]; // References to object IDs
  characters: string[]; // References to character IDs
}

export interface Exit {
  direction: string;
  targetRoomId: string;
  description?: string;
  isLocked?: boolean;
  keyId?: string; // ID of the key object needed to unlock
}

export interface GameObject {
  id: string;
  name: string;
  description: string;
  traits: string[]; // e.g., "takeable", "container", "edible"
  states: Record<string, boolean>; // e.g., { "open": false, "lit": true }
  containedObjects?: string[]; // IDs of objects inside if this is a container
  allowedActions: string[]; // What actions can be performed on this object
}

export interface Character {
  id: string;
  name: string;
  description: string;
  dialogue: Record<string, string>; // Topic -> response mapping
  inventory: string[]; // IDs of objects the character has
  defaultResponse: string; // Response when topic not found
  mood?: string; // Current mood affecting responses
}

export interface Action {
  name: string;
  patterns: string[]; // Example natural language patterns this action matches
  requiresObject?: boolean;
  requiresTarget?: boolean;
  handler: string; // Name of method to handle this action
}

export interface GameState {
  currentRoomId: string;
  inventory: string[]; // IDs of objects in player's inventory
  visitedRooms: string[]; // IDs of rooms the player has visited
  flags: Record<string, boolean>; // Game state flags
  counters: Record<string, number>; // Game state counters
}

export interface WorldModel {
  title: string;
  author: string;
  version: string;
  introduction: string;
  rooms: Record<string, Room>;
  objects: Record<string, GameObject>;
  characters: Record<string, Character>;
  actions: Record<string, Action>;
  initialState: GameState;
}