/** Shared, dependency-free map geometry + projection types (client + server). */

export interface Cell {
  col: number;
  row: number;
}

export interface Point {
  x: number;
  y: number;
}

/** Everything geometry needs about the current grid, in natural image pixels. */
export interface GridSpec {
  gridSize: number; // px per cell (natural image space)
  feetPerCell: number;
  cols: number;
  rows: number;
}

export type DistanceMode = '5e' | 'pf2e' | 'euclid';

// ---- Player-facing projection (what a player may see) ----

export interface PlayerToken {
  id: string;
  label: string;
  color: string;
  col: number;
  row: number;
  size: number;
  kind: 'pc' | 'npc' | 'monster' | 'object';
  /** id into the session image cache (token icon), if any */
  imageId?: string;
  hp?: { current: number; max: number; temp: number };
  conditions: { name: string; value?: number }[];
}

export interface PlayerDrawing {
  id: string;
  kind: 'freehand' | 'line' | 'rect' | 'circle' | 'arrow' | 'text';
  points: Point[];
  color: string;
  width: number;
  text?: string;
}

export interface PlayerMap {
  id: string;
  name: string;
  gridSize: number;
  showGrid: boolean;
  fogEnabled: boolean;
  revealed: string[];
  gridType: 'square' | 'hex';
  gridUnit: { feet: number };
  tokens: PlayerToken[];
  drawings: PlayerDrawing[];
  /** whether an image exists (the data URL itself travels separately) */
  hasImage: boolean;
}
