<?php

namespace Tests\App\Libraries;

use App\Libraries\Tuition\OldTuitionCalculatorService;
use CodeIgniter\Test\CIUnitTestCase;

class OldTuitionCalculatorServiceTest extends CIUnitTestCase
{
    public function testRegularAndYouthStudentsUseLegacyRules(): void
    {
        $service = new OldTuitionCalculatorService();
        $result = $service->calculateFamilyTuition([
            ['student_id' => 3, 'student_name' => 'Older Youth', 'grade_level' => 'Youth 1'],
            ['student_id' => 1, 'student_name' => 'First Regular', 'grade_level' => '3'],
            ['student_id' => 2, 'student_name' => 'Second Regular', 'grade_level' => '5'],
        ], [
            'grade_fee' => 9,
            'first_student_fee' => '350.00',
            'second_student_fee' => '200.00',
            'youth_fee' => '180.00',
        ]);

        $this->assertSame('730.00', $result['total']);
        $this->assertSame('old_first_student_fee', $result['details'][0]['rule']);
        $this->assertSame('old_second_student_fee', $result['details'][1]['rule']);
        $this->assertSame('old_youth_fee', $result['details'][2]['rule']);
    }
}
