import type { Archetype } from './types';

export interface ArchetypeDef {
  key: Archetype;
  /** Spawn weight in the general queue mix. 0 = only spawned by script/override. */
  weight: number;
  ageRange: [number, number];
  toleranceRange: [number, number];
  /** Starting intoxication range at 9 PM; drifts up with arrival time. */
  startDrunkRange: [number, number];
  chances: {
    fakeId?: number;
    contraband?: number;
    claimsGuestList?: number;
    onGuestList?: number;
    knowsOwner?: number;
  };
}

export const ARCHETYPES: readonly ArchetypeDef[] = [
  { key: 'punter', weight: 50, ageRange: [18, 45], toleranceRange: [0.3, 0.8], startDrunkRange: [0, 0.3], chances: { fakeId: 0.02, contraband: 0.08, claimsGuestList: 0.05 } },
  { key: 'fresh18', weight: 8, ageRange: [18, 18], toleranceRange: [0.1, 0.35], startDrunkRange: [0, 0.15], chances: {} },
  { key: 'almost18', weight: 7, ageRange: [17, 17], toleranceRange: [0.1, 0.4], startDrunkRange: [0, 0.25], chances: { fakeId: 1 } },
  { key: 'financeBro', weight: 10, ageRange: [23, 34], toleranceRange: [0.4, 0.75], startDrunkRange: [0.15, 0.55], chances: { contraband: 0.25, claimsGuestList: 0.15, knowsOwner: 0.02 } },
  { key: 'influencer', weight: 7, ageRange: [19, 29], toleranceRange: [0.3, 0.6], startDrunkRange: [0, 0.25], chances: { claimsGuestList: 0.75, onGuestList: 0.2, contraband: 0.1 } },
  { key: 'regular', weight: 8, ageRange: [25, 55], toleranceRange: [0.6, 0.95], startDrunkRange: [0.1, 0.4], chances: { onGuestList: 0.1 } },
  { key: 'ownersMate', weight: 3, ageRange: [30, 60], toleranceRange: [0.5, 0.9], startDrunkRange: [0.1, 0.5], chances: { claimsGuestList: 0.9, knowsOwner: 0.6 } },
  { key: 'quietMessy', weight: 6, ageRange: [20, 38], toleranceRange: [0.1, 0.3], startDrunkRange: [0.25, 0.5], chances: { contraband: 0.15 } },
  { key: 'inspector', weight: 1, ageRange: [38, 55], toleranceRange: [0.9, 1], startDrunkRange: [0, 0], chances: {} },
];

export const ARCHETYPE_BY_KEY: ReadonlyMap<Archetype, ArchetypeDef> = new Map(
  ARCHETYPES.map((a) => [a.key, a]),
);
