<?php

namespace Tests\Unit\Services\Events;

use App\Services\Events\EventStudentChargeService;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Support\Facades\DB;
use Tests\TestCase;

class EventStudentChargeServiceTest extends TestCase
{
    use RefreshDatabase;

    public function test_list_students_with_charges(): void
    {
        DB::table('students')->insert([
            'id' => 1,
            'parent_id' => 10,
            'firstname' => 'Kid',
            'lastname' => 'One',
        ]);

        DB::table('event_charges')->insert([
            'id' => 1,
            'event_id' => 1,
            'parent_id' => 10,
            'student_id' => 1,
            'participation' => 'yes',
            'charged' => 10,
            'school_year' => '2025-2026',
            'semester' => 'Fall',
        ]);

        $service = new EventStudentChargeService();
        $rows = $service->listStudentsWithCharges(10, '2025-2026', 'Fall');

        $this->assertTrue($rows[0]['charged']);
    }
}
