<?php

namespace Tests\Unit\Services\Invoices;

use App\Services\Invoices\InvoiceConfigService;
use App\Services\Invoices\InvoiceGenerationService;
use App\Services\Invoices\InvoiceGradeService;
use App\Services\Invoices\InvoiceManagementService;
use App\Services\Invoices\InvoiceService;
use App\Services\Invoices\InvoiceTuitionService;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Support\Facades\DB;
use Mockery;
use Tests\TestCase;

class InvoiceServiceTest extends TestCase
{
    use RefreshDatabase;

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

        DB::table('student_class')->insert([
            'id' => 1,
            'student_id' => 1,
            'class_section_id' => 101,
            'school_year' => '2025-2026',
        ]);

        $service = new InvoiceService(
            Mockery::mock(InvoiceConfigService::class),
            Mockery::mock(InvoiceManagementService::class),
            Mockery::mock(InvoiceGenerationService::class),
            Mockery::mock(InvoiceTuitionService::class),
            Mockery::mock(InvoiceGradeService::class)
        );

        $this->assertTrue($service->hasClassAssignment('2025-2026', 10));
    }
}
