<?php

namespace Tests\Unit\Services\Events;

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

class EventChargeQueryServiceTest extends TestCase
{
    use RefreshDatabase;

    public function test_list_returns_paginated_charges(): void
    {
        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',
            'created_at' => now(),
            'updated_at' => now(),
        ]);

        $service = new EventChargeQueryService();
        $result = $service->list(['per_page' => 10, 'page' => 1]);

        $this->assertSame(1, $result['pagination']['total']);
    }
}
