// Scripted-encounter dialogue (design §4.3). These are the most rewritten strings
// in the project and the ones a content pass is most likely to ruin.
//
// The register, in order of importance:
//  - Nobody begs. Every one of these people is competent, has a plan, and is
//    offering you information rather than asking for mercy.
//  - The game never says which call was right. `admitNote`/`denyNote` land on the
//    verdict toast, so they report what happened next and stop. No verdict on the
//    player, no reassurance either — reassurance is a verdict wearing a smile.
//  - Dazza may judge freely. He is a character inside the fiction and he is wrong
//    constantly; that is not the game speaking.
//
// `afterMs` is measured from the moment the patron reaches the rope, not from the
// previous beat, so a skipped line cannot compress the ones after it.

export interface EncounterScript {
  /** Licence names to draw from — the same person, spelled a few different ways. */
  names: readonly string[];
  beats: readonly { readonly line: string; readonly afterMs: number }[];
  admitNote?: string;
  admitDazza?: string;
  denyNote?: string;
  denyDazza?: string;
  /** Coin-flip encounters (real/fake cop, rocket/paps): notes per variant key.
   * The variant is decided at dress() time and carried on patron.flags. */
  variantNotes?: Record<string, { admitNote?: string; admitDazza?: string; denyNote?: string; denyDazza?: string }>;
}

export const ENCOUNTER_SCRIPTS: Record<string, EncounterScript> = {
  // She is not asking to party. She is asking for ninety seconds and a jacket,
  // and she already knows the stamp rule better than you do.
  grabHerMate: {
    names: ['Bec Doyle', 'Steph Vella', 'Aleisha Marsh'],
    beats: [
      { line: 'i was inside ten minutes ago. no stamp, i know.', afterMs: 0 },
      { line: "my mate's on a date in there thats gone bad. shes done the toilet text twice.", afterMs: 2200 },
      { line: "ninety seconds. i get her and her jacket and we're both gone.", afterMs: 4600 },
    ],
    // Reports the stamp, not the room: nothing here can see the clicker count,
    // and a note that asserts capacity is simply false half the time.
    admitNote: 'Back in without a stamp. Nothing on the door says she was ever inside.',
    admitDazza: 'the count and the clicker dont agree mate. i count from the office. i COUNT',
    denyNote: 'She waits under the awning across the road, then walks toward the taxi rank.',
  },

  // The dumped bloke. The tell is the over-explaining, not the swaying. He says
  // the title of the game and does not notice he said it.
  quietBeer: {
    names: ['Trent Petersen', 'Dylan Marsh', 'Cam Duffy'],
    beats: [
      { line: 'evening. just the one, then im off.', afterMs: 0 },
      { line: 'ive had two at the RSL. before you ask.', afterMs: 2100 },
      { line: 'no, no one with me. not tonight.', afterMs: 4400 },
      { line: 'one beer. thats the whole plan.', afterMs: 6600 },
    ],
    admitNote: 'Loose at the rope. Where it goes from here is between him and the bar.',
    admitDazza: 'theres a bloke at the end of the bar not drinking his drink. keep half an eye',
    denyNote: 'He says no dramas. He is at the kebab shop ten minutes later.',
  },

  // Seven years, and he has brought a hip flask to shout the bar staff with. He
  // tells you about it, which is the entire trap — you cannot un-know it.
  lastNight: {
    names: ['Warren Kowalski', 'Raymond Vella', 'Gary Duffy'],
    beats: [
      { line: 'last one, mate. flights booked. perth on thursday.', afterMs: 0 },
      { line: 'seven years ive been coming here. you knocked me back once, back in nineteen. fair enough too.', afterMs: 2400 },
      { line: 'i brought this for sue behind the bar. she reckons she wants a proper send off.', afterMs: 4800 },
    ],
    admitNote: 'The flask went in with him.',
    denyNote: 'He waves it off. In the car park he opens the flask himself.',
  },

  // Off a twelve-hour shift in a branded work polo, which the dress code has had
  // an opinion about since 10:30. He knows. He says so before you can.
  nightShift: {
    names: ['Jared Karim', 'Tui Taufa', 'Sam Nguyen'],
    beats: [
      { line: 'sorry. straight off shift. i know how it looks.', afterMs: 0 },
      { line: 'twelve hours. the polos got the servo on it, cant do much about that.', afterMs: 2300 },
      { line: 'one beer, near the door, i wont go near the dancefloor. i dont have it in me.', afterMs: 4700 },
    ],
    admitNote: 'In he goes, logo and all, with the sign already up.',
    denyNote: 'He nods, says fair enough, and walks back toward the servo.',
  },
  // Eighteen at midnight, at the rope by quarter past. Real card, real birthday,
  // and a plan he has clearly rehearsed on the walk over.
  eighteenToday: {
    names: ['Jai Petersen', 'Cooper Nguyen', 'Lachy Marsh'],
    beats: [
      { line: 'evening. so. it went midnight about forty minutes ago.', afterMs: 0 },
      { line: 'which makes this my first legal one. checked the law twice.', afterMs: 2400 },
      { line: 'my mates did the countdown at the kebab shop. they went home. im here.', afterMs: 5000 },
    ],
    admitNote: 'First stamp on a first night. He shows the bar staff his licence unprompted.',
    denyNote: 'Legal for forty minutes and headed home. The story will improve with age.',
  },

  // Kayden has been making promises. Kayden does not have list privileges.
  // Kayden does not, strictly speaking, have a last name anyone can recall.
  kaydensMate: {
    names: ['Reece Kowalski', 'Jordan Vella', 'Tyson Doyle'],
    beats: [
      { line: 'should be right, kayden said hed leave my name at the door.', afterMs: 0 },
      { line: 'kayden. tall bloke. trainee vest. very confident handshake.', afterMs: 2300 },
      { line: 'he said quote unquote "sorted mate". thats basically a guest list.', afterMs: 4800 },
    ],
    admitNote: 'In on the authority of a man whose supervisor calls him "the situation".',
    admitDazza: 'a bloke just told the bar KAYDEN comped him. kayden cant comp a glass of water',
    denyNote: 'He takes it well. Says he will "raise it with kayden". Nobody will.',
  },

  // The buck's party straggler. Missed the church bit, missed dinner, caught the
  // food poisoning. The buck is inside; the night is nearly over; here he is.
  bigNightOut: {
    names: ['Macca OBrien', 'Davo Romano', 'Nick Taufa'],
    beats: [
      { line: 'the bucks is in there. i can hear the chanting. thats my chanting.', afterMs: 0 },
      { line: 'i missed the church bit. food poisoning at the dinner. long story. bad oysters.', afterMs: 2500 },
      { line: 'ive had a big recovery and two lemonades and i am READY to be present.', afterMs: 5200 },
    ],
    admitNote: 'The chanting gets louder, gains a name in it, then settles.',
    denyNote: 'He listens to one more chant through the wall, films a voice memo of it, and goes.',
  },

  // Engaged tonight. Still holding hands. The card says what the card says.
  twoOfThem: {
    names: ['Bree Karim', 'Holly Petersen', 'Sana Singh'],
    beats: [
      { line: 'before you say anything about the hand thing. we got engaged tonight.', afterMs: 0 },
      { line: 'TONIGHT tonight. at the lookout. theres a photo of a bird ruining it.', afterMs: 2400 },
      { line: 'we are aware of the rule. we have discussed it. the answer is no.', afterMs: 5000 },
    ],
    admitNote: 'They cross the floor like a three-legged race nobody can catch.',
    denyNote: 'They leave still attached. The rule holds. The rule is the only thing that does.',
  },

  // The badge is real or it cost $30, and the licence is the only thing at the
  // rope that knows which. He is polite either way. That is the problem.
  offDutyCop: {
    names: ['Marcus Bell', 'Marc Bell', 'M. Bell'],
    beats: [
      { line: "evening. job's done for the night. just after a quiet one.", afterMs: 0 },
      { line: 'you can look at the badge if you want. most dont.', afterMs: 2400 },
      { line: 'take your time with the licence. i respect the process.', afterMs: 5000 },
    ],
    variantNotes: {
      real: {
        admitNote: 'He orders soda water and stands where he can see both exits.',
        denyNote: 'He nods once. "Good call. Always." He means it.',
      },
      fake: {
        admitNote: 'The badge says JUNIOR DETECTIVE on the back. Nobody looks at the back.',
        denyNote: 'He argues, then folds. The badge goes back in the bumbag.',
      },
    },
  },

  // Cap low, sunnies on, at night. Two live rule breaches and a face you
  // almost place. Denying is free forever. Admitting is a coin you cannot see.
  celebrity: {
    names: ['Ky Trainor', 'Kai Trainor', 'K. Trainor'],
    beats: [
      { line: 'hey. so. yeah.', afterMs: 0 },
      { line: "it'd be really good if this could be quick.", afterMs: 2200 },
      { line: 'the sunnies stay on. sorry. they sort of have to.', afterMs: 4600 },
    ],
    variantNotes: {
      rocket: { admitNote: 'Halfway to the bar, someone does a double-take.' },
      paps: {
        admitNote: 'A ute pulls up across the road. Then another one.',
        admitDazza: 'why are there seventeen blokes with cameras outside. WHY',
      },
    },
    denyNote: 'The cap goes lower and they walk. You will never know who that was.',
  },

  // An aggro engine in a polo. His licence is a laminated business card and he
  // is PROUD of it. Nothing about him is a question the desk can answer.
  sovereign: {
    names: ['Gregory-John: Harmon', 'G-J: Harmon', 'Gregory-John of Harmon'],
    beats: [
      { line: 'before we begin: i do not consent to this dress code.', afterMs: 0 },
      { line: 'your rope is an admiralty flag. i am a living man, travelling.', afterMs: 2600 },
      { line: 'i will be entering under common law. watch.', afterMs: 5200 },
    ],
    admitNote: 'He steps over the rope rather than through the gap. On principle.',
    denyNote: 'He accepts no jurisdiction, but does, eventually, accept the footpath.',
  },

  // The thermal bag says a name. The name is "DJ". The booth lamp flickers.
  deliveryRider: {
    names: ['Sanjay Pillai', 'San Pillai', 'S. Pillai'],
    beats: [
      { line: 'delivery for "DJ". thats it. just says DJ.', afterMs: 0 },
      { line: 'its getting cold mate. the bag only does so much.', afterMs: 2400 },
      { line: 'ive got four more jobs on. yes or no.', afterMs: 4800 },
    ],
    variantNotes: {
      ordered: {
        admitNote: 'The booth lamp stops flickering. So. He HAD ordered.',
        denyNote: 'The rider shrugs and eats it on the kerb. It looked incredible.',
      },
      not: {
        admitNote: 'He wanders the floor with the bag, calling a name nobody has.',
        denyNote: 'He checks the address, swears with real feeling, and rides off.',
      },
    },
  },

  // Two clipboards enter. One leaves.
  promoter: {
    names: ['Tyson Vale', 'Ty Vale', 'T. Vale'],
    beats: [
      { line: 'evening chief. tyson. i run thursdays at elevate.', afterMs: 0 },
      { line: 'youve got a list. ive got a list. mine is realer.', afterMs: 2600 },
      { line: 'roll of wristbands here says we can help each other.', afterMs: 5200 },
    ],
    admitNote: 'He shakes your hand like something just went well for him.',
    admitDazza: 'who is TYSON and why do nine people think his wristband beats my list',
    denyNote: 'He films a story outside: "this venue hates culture." 41 views.',
  },

  // Pyjamas, at the rope, at 1 AM. The only person all night who wants LESS
  // club. She is not wrong about the bass.
  neighbour: {
    names: ['Carol Whitford', 'Caz Whitford', 'C. Whitford'],
    beats: [
      { line: 'im not coming in. lord, no.', afterMs: 0 },
      { line: 'number 12, across the laneway. its the bass. my GLASSES are walking.', afterMs: 2600 },
      { line: 'either it comes down or i ring the council again. your choice, love.', afterMs: 5400 },
    ],
    admitNote: 'She stands in the booth doorway pointing at the subwoofer until it comes down 2dB. Peace, of a kind.',
    denyNote: 'She photographs the queue on her way home. For the file.',
  },

  // Wrong venue, right energy, seven matching sashes. A vibe grenade with a
  // random timer, and the pin is in your hand.
  hensParty: {
    names: ['Melissa Tran', 'Mel Tran', 'M. Tran'],
    beats: [
      { line: 'ok so, small thing: this is not the venue on the invitation.', afterMs: 0 },
      { line: 'HOWEVER. the venue on the invitation has a queue.', afterMs: 2400 },
      { line: 'there are seven of us and we have practised a dance.', afterMs: 4800 },
    ],
    admitNote: 'Seven sashes file past. The bar staff make eye contact with god.',
    denyNote: 'They find the right venue. You hear the scream of joy from two streets over.',
  },

  // Genuinely twins. Everything the photo check believes is suddenly on trial,
  // and both of them have done this bit at every door in the Valley.
  twins: {
    names: ['Jesse Kearney', 'Jordan Kearney'],
    beats: [
      { line: 'evening. before you ask: yes. there is two of me.', afterMs: 0 },
      { line: 'my brothers parking the car. we get this a LOT.', afterMs: 2600 },
      { line: 'same face, different bloke. this licence is mine. his is his.', afterMs: 5200 },
    ],
    admitNote: 'One of two, in. That face will be back in five minutes under a different name.',
    denyNote: 'He rings his brother from the kerb: "told you. same face, no entry."',
  },

  // Fourteen years on this exact door. His tips are right about eighty percent
  // of the time, which is the joke, and also fourteen years of doors.
  exDoorman: {
    names: ['Frank Oxley', 'Franko Oxley', 'F. Oxley'],
    beats: [
      { line: 'fourteen years i worked this exact door. before the rebrand.', afterMs: 0 },
      { line: 'dont mind me. just gonna watch a few. old times.', afterMs: 2600 },
      { line: 'ill be by the planter. tip or two, free of charge.', afterMs: 5200 },
    ],
    admitNote: 'He does one lap inside and comes straight back out to the planter. The door IS the venue, for him.',
    denyNote: 'Completely unbothered. He sets up by the planter with a dart. "Better view out here anyway."',
  },
};

