export type Point = {
  x: number;
  y: number;
};

export type Geometry = {
  name: string;
  vertices: Point[];
  options?: Record<string, any>;
  pos?: string;
};

export interface ToothGeometry {
  top: { tl: Point; tr: Point; br: Point; bl: Point };
  right: { tl: Point; tr: Point; br: Point; bl: Point };
  bottom: { tl: Point; tr: Point; br: Point; bl: Point };
  left: { tl: Point; tr: Point; br: Point; bl: Point };
  middle: { tl: Point; tr: Point; br: Point; bl: Point };
}

export interface Tooth {
  num: string;
  bigBoxSize: number;
  smallBoxSize: number;
  x1: number;
  y1: number;
  x2: number;
  y2: number;
  cx: number;
  cy: number;
  geometry: ToothGeometry;
}

export enum OdontogramMode {
  DEFAULT = 0,
  AMF = 1,
  COF = 2,
  FIS = 3,
  NVT = 4,
  RCT = 5,
  NON = 6,
  UNE = 7,
  PRE = 8,
  ANO = 9,
  CARIES = 10,
  CFR = 11,
  FMC = 12,
  POC = 13,
  RRX = 14,
  MIS = 15,
  IPX = 16,
  FRM_ACR = 17,
  BRIDGE = 18,
  ARROW_TOP_LEFT = 19, // TOP-LEFT ARROW
  ARROW_TOP_RIGHT = 20, // TOP-RIGHT ARROW
  ARROW_TOP_TURN_LEFT = 21, // TOP-TURN-LEFT ARROW
  ARROW_TOP_TURN_RIGHT = 22, // TOP-TURN-RIGHT ARROW
  ARROW_BOTTOM_LEFT = 23, // BOTTOM-LEFT ARROW
  ARROW_BOTTOM_RIGHT = 24, // BOTTOM-RIGHT ARROW
  ARROW_BOTTOM_TURN_LEFT = 25, // BOTTOM-TURN-LEFT ARROW
  ARROW_BOTTOM_TURN_RIGHT = 26, // BOTTOM-TURN-RIGHT ARROW
  HAPUS = 100
  // Arrow modes can be added here
}

export interface ToothCondition {
  mode: OdontogramMode;
  position: string;
  toothNumber: string;
  surface?: "T" | "R" | "B" | "L" | "M"; // Top, Right, Bottom, Left, Middle
  group?: number; // Group number for bridge conditions
  timestamp?: string; // Optional tracking
}

export interface OdontogramData {
  conditions: ToothCondition[];
  metadata: {
    patientId?: string;
    date: string;
    dentist?: string;
  };
  currentMode?: OdontogramMode;
}
