<?php

require dirname(__DIR__) . '/app/ai/form_generator_default_skills.php';

function assertEq(mixed $a, mixed $b, string $label): void
{
    if ($a !== $b) {
        echo 'FAIL: ' . $label . ' (got ' . var_export($a, true) . ', want ' . var_export($b, true) . ')' . PHP_EOL;
        exit(1);
    }
    echo 'OK: ' . $label . PHP_EOL;
}

assertEq(formGeneratorNormalizeManualSkillsList([]), [], 'empty selection');
assertEq(
    formGeneratorNormalizeManualSkillsList(['Emergency Management', 'Diagnosis']),
    ['Diagnosis', 'Emergency Management'],
    'canonical order'
);
assertEq(
    formGeneratorSkillForQuestionNumber(['Diagnosis', 'Management', 'Prescribing'], 2),
    'Management',
    'question 2 maps to second skill'
);
assertEq(
    formGeneratorSkillForQuestionNumber(['Diagnosis', 'Management', 'Prescribing'], 3),
    'Prescribing',
    'question 3 maps to third skill'
);

echo PHP_EOL . 'All skill question count tests passed.' . PHP_EOL;
