<?php

declare(strict_types=1);

require_once dirname(__DIR__) . '/prompts/sba_combined_tutor_reviewer_prompt.php';

$minimal = [
    'specialty' => 'Cardiology',
    'condition_name' => 'ACS',
    'presentation' => 'Chest pain',
    'year_level' => 'Year 5',
    'summative_formative' => 'Formative',
    'skill' => 'Diagnosis',
    'tutor_comments' => '',
    'title' => 'ACS diagnosis',
    'stem' => 'A 65 year old man has central chest pain.',
    'lead_in' => 'What is the most likely diagnosis?',
    'option_a' => 'ACS',
    'option_b' => 'PE',
    'option_c' => 'Aortic dissection',
    'option_d' => 'GORD',
    'option_e' => 'Costochondritis',
    'correct_answer_letter' => 'A',
    'correct_answer' => 'ACS',
    'justification' => 'Typical presentation.',
];

$copdStem = str_repeat(
    'He has progressive breathlessness. ',
    40
) . 'His temperature is 36.5°C, pulse 98 bpm, BP 150/90 mmHg, respiratory rate 20 breaths per minute and oxygen saturation is 88% breathing air.';

$copd = $minimal;
$copd['condition_name'] = 'COPD';
$copd['skill'] = 'Prescribing';
$copd['stem'] = 'A 72 year old man with COPD. ' . $copdStem;

$warnings = array_fill(0, 25, [
    'code' => 'uk.example',
    'severity' => 'warning',
    'field' => 'stem',
    'message' => 'Example style warning for prompt size test.',
]);

foreach (
    [
        'minimal ACS' => buildSbaCombinedTutorReviewerPrompt($minimal, [], []),
        'COPD long stem' => buildSbaCombinedTutorReviewerPrompt($copd, $warnings, []),
    ] as $label => $prompt
) {
    $chars = strlen($prompt);
    $approxTokens = (int) ceil($chars / 4);
    echo "{$label}: {$chars} chars (~{$approxTokens} tokens)\n";
}
