<?php

namespace Tests\Unit\Services\Administrator;

use App\Services\Administrator\AdministratorMetricsService;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Support\Facades\DB;
use Tests\TestCase;

class AdministratorMetricsServiceTest extends TestCase
{
    use RefreshDatabase;

    public function test_metrics_returns_counts(): void
    {
        DB::table('configuration')->insert([
            ['id' => 1, 'config_key' => 'school_year', 'config_value' => '2025-2026'],
            ['id' => 2, 'config_key' => 'semester', 'config_value' => 'Fall'],
        ]);

        $service = new AdministratorMetricsService(
            new \App\Services\Administrator\AdministratorSharedService(new \App\Models\Configuration()),
            new \App\Models\User(),
            new \App\Models\LoginActivity()
        );

        $metrics = $service->metrics();

        $this->assertSame(0, $metrics['counts']['students']);
        $this->assertSame('2025-2026', $metrics['meta']['schoolYear']);
    }
}
