/**
 * School Test and Exam Events
 * Standardized tests and exam preparation (ages 15-18)
 */

import { Player } from '../../models/Player';
import { createMessageEvent, createQuestionEvent, checkProbability, type EventResult } from '../base';

export function actTest(player: Player, _type: 'message' | 'question' = 'message'): EventResult {
  const fname = 'actTest';
  const check = player.character.education === '12th' &&
    player.monthOfYear > 9 &&
    player.character.ageYears >= 16 &&
    player.character.ageYears < 19 &&
    !player.events.has(fname) &&
    player.character.location.includes('school');

  if (check) {
    player.events.add(fname);
    // Note: In full implementation, would add schedule for studying
  }

  return createMessageEvent(
    fname,
    "Your guidance counselor reminds you of the upcoming ACT test. It's time to get studying!",
    player,
    check
  );
}

export function actTestTake(player: Player, _type: 'message' | 'question' = 'message'): EventResult {
  const fname = 'actTestTake';
  // Note: In full implementation, would check scheduleComplete
  const check = !player.character.actScore &&
    player.character.ageYears >= 17 &&
    !player.askedQuestions.has(fname);

  if (check) {
    player.askedQuestions.add(fname);
  }

  return createQuestionEvent(
    fname,
    "Today is your ACT test!",
    player,
    check,
    {
      answerOptions: ["I've done all the studying I can."]
    }
  );
}

export function satTest(player: Player, _type: 'message' | 'question' = 'message'): EventResult {
  const fname = 'satTest';
  const check = player.character.education === '12th' &&
    player.dayOfYear === 1 &&
    player.character.ageYears >= 17 &&
    player.character.ageYears < 19 &&
    !player.events.has(fname) &&
    player.character.location.includes('school');

  if (check) {
    player.events.add(fname);
    // Note: In full implementation, would add schedule for studying
  }

  return createMessageEvent(
    fname,
    "Your guidance counselor reminds you of the upcoming SAT test. It's time to get studying!",
    player,
    check
  );
}
