import type { FdiToothId } from '@/types/treatment';

/** Upper arch: distal → mesial on each side (full occlusal layout left → right) */
export const FDI_UPPER_LEFT_TO_RIGHT: FdiToothId[] = [
  '18', '17', '16', '15', '14', '13', '12', '11',
  '21', '22', '23', '24', '25', '26', '27', '28',
];

/** Lower arch */
export const FDI_LOWER_LEFT_TO_RIGHT: FdiToothId[] = [
  '48', '47', '46', '45', '44', '43', '42', '41',
  '31', '32', '33', '34', '35', '36', '37', '38',
];

export type ToothShapeKind = 'incisor' | 'canine' | 'premolar' | 'molar';

/** Infer cartoon shape from FDI (last digit encodes tooth type within quadrant). */
export function getToothShapeKind(fdi: FdiToothId): ToothShapeKind {
  const n = Number(fdi.slice(1));
  if (n <= 2) return 'incisor';
  if (n === 3) return 'canine';
  if (n <= 5) return 'premolar';
  return 'molar';
}
