export const ARCHETYPE_IDS = [
  'architect',
  'luminary',
  'marshal',
  'broker',
  'navigator',
  'builder',
  'overseer',
  'engineer',
] as const;

export type ArchetypeId = (typeof ARCHETYPE_IDS)[number];

/** Stable one-letter keys used in result codes. Never reorder: shared links depend on them. */
export const ARCHETYPE_LETTERS: Record<ArchetypeId, string> = {
  architect: 'A',
  luminary: 'B',
  marshal: 'C',
  broker: 'D',
  navigator: 'E',
  builder: 'F',
  overseer: 'G',
  engineer: 'H',
};

export function isArchetypeId(value: unknown): value is ArchetypeId {
  return typeof value === 'string' && (ARCHETYPE_IDS as readonly string[]).includes(value);
}

export interface Book {
  title: string;
  author: string;
  why: string;
}

export interface Archetype {
  id: ArchetypeId;
  letter: string;
  monogram: string;
  name: string;
  aliases: string[];
  role: string;
  color: string;
  tagline: string;
  core: string;
  strengths: string[];
  watchOuts: string[];
  complements: [ArchetypeId, ArchetypeId];
  complementNote: string;
  moveThisWeek: string;
  atBest: string;
  underPressure: string;
  predictableCost: string;
  /** Completes the sentence "Your supporting side adds …" */
  asSupport: string;
  keep: string;
  delegate: string;
  design: string;
  /** One archetype-specific action for each week of the 30-day plan. */
  plan: [string, string, string, string];
  loop: { step: number; verb: string };
  book: Book;
}

export interface LikertQuestion {
  id: string;
  kind: 'likert';
  archetype: ArchetypeId;
  text: string;
}

export interface ScenarioOption {
  archetype: ArchetypeId;
  text: string;
}

export interface ScenarioQuestion {
  id: string;
  kind: 'scenario';
  text: string;
  options: ScenarioOption[];
}

export type Question = LikertQuestion | ScenarioQuestion;

/** A Likert answer is 1–5; a scenario answer is the archetype behind the chosen option. */
export type Answer = number | ArchetypeId;

export interface LikertOption {
  value: number;
  label: string;
}
