<?php

namespace Tests\Unit\Services\Administrator;

use App\Services\Administrator\TeacherSubmissionReportService;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Mockery;
use Tests\TestCase;

class TeacherSubmissionReportServiceTest extends TestCase
{
    use RefreshDatabase;

    public function test_report_returns_summary(): void
    {
        $shared = Mockery::mock(\App\Services\Administrator\AdministratorSharedService::class);
        $shared->shouldReceive('getSemester')->andReturn('Fall');
        $shared->shouldReceive('getSchoolYear')->andReturn('2025-2026');

        $support = Mockery::mock(\App\Services\Administrator\TeacherSubmissionSupportService::class);
        $support->shouldReceive('submissionStatus')->andReturn([
            'label' => 'No students',
            'badge' => 'bg-secondary',
            'detail' => '',
            'completed' => true,
        ]);
        $support->shouldReceive('attendanceStatus')->andReturn([
            'label' => 'Missing',
            'badge' => 'bg-danger',
            'completed' => false,
        ]);
        $support->shouldReceive('buildMissingItems')->andReturn([]);
        $support->shouldReceive('teacherRolePriority')->andReturn(1);

        $service = new TeacherSubmissionReportService($shared, $support);
        $report = $service->report();

        $this->assertArrayHasKey('summary', $report);
        $this->assertSame('2025-2026', $report['schoolYear']);
    }
}
