import type { EventDefinition } from '../types.js';

function choice(
  choiceId: string,
  text: string,
  resolutionText: string,
  overrides?: Partial<EventDefinition['choices'][number]>
): EventDefinition['choices'][number] {
  return {
    choiceId,
    text,
    resolutionText,
    ...overrides,
  };
}

export const educationCatalog: EventDefinition[] = [
  {
    id: 'chooseMajor',
    category: 'education',
    prompt: 'You need to choose a major. What drives your decision?',
    minAge: 17,
    maxAge: 25,
    isEligible: (player) => (player.c.occupation as string | undefined) === 'student',
    choices: [
      choice(
        'follow_interest',
        'Choose what you love',
        'You chose a major aligned with your interests and motivation improved.',
        { effects: { stats: { happiness: 15 } } }
      ),
      choice(
        'career_security',
        'Choose for career stability',
        'You chose a practical path with strong long-term earning potential.',
        { effects: { stats: { happiness: 5, social: 3 } } }
      ),
      choice(
        'family_pressure',
        'Follow family expectations',
        'You followed family expectations, but felt less ownership of the path.',
        { effects: { stats: { happiness: -8 } } }
      ),
    ],
  },
  {
    id: 'reportCardDay',
    category: 'education',
    prompt: 'Report cards are out. How do you respond to your results?',
    minAge: 10,
    maxAge: 18,
    choices: [
      choice(
        'celebrate_and_plan',
        'Celebrate and set a new goal',
        'You celebrated progress and set concrete targets for next term.',
        { effects: { stats: { happiness: 10 } } }
      ),
      choice(
        'ask_for_help',
        'Ask for help where needed',
        'You asked for support and built a stronger study plan.',
        { effects: { stats: { social: 8, happiness: 6 } } }
      ),
      choice(
        'ignore_it',
        'Ignore it',
        'You ignored the feedback and repeated weak habits.',
        { effects: { stats: { happiness: -7 } } }
      ),
    ],
  },
  {
    id: 'schoolDance',
    category: 'education',
    prompt: 'School dance night is coming. What do you do?',
    minAge: 13,
    maxAge: 18,
    choices: [
      choice(
        'go_with_friends',
        'Go with friends',
        'You went with friends and had a memorable night.',
        { effects: { stats: { social: 12, happiness: 8 } } }
      ),
      choice(
        'ask_someone',
        'Ask someone to go with you',
        'You asked someone directly and built confidence either way.',
        { energyCost: 5, effects: { stats: { social: 10, happiness: 5 } } }
      ),
      choice(
        'skip_event',
        'Skip the dance',
        'You skipped the dance and spent the evening your own way.',
        { effects: { stats: { happiness: -2 } } }
      ),
    ],
  },
  {
    id: 'tutoringRequest',
    category: 'education',
    prompt: 'A classmate asks for tutoring before an exam. How do you respond?',
    minAge: 12,
    maxAge: 22,
    choices: [
      choice(
        'help_thoroughly',
        'Help them thoroughly',
        'You spent time tutoring and both of you learned more.',
        { energyCost: 10, effects: { stats: { social: 10, happiness: 6 } } }
      ),
      choice(
        'share_notes',
        'Share notes only',
        'You offered notes and a quick review to help efficiently.',
        { effects: { stats: { social: 5, happiness: 3 } } }
      ),
      choice(
        'decline',
        'Decline',
        'You declined to focus on your own preparation.',
        { effects: { stats: { social: -4 } } }
      ),
    ],
  },
];
