<?php

it('registers department weather target routes with explicit read and manage permissions', function (): void {
    $routeFile = app_path('routes/moduleWeatherAPIRoute.php');
    $content = file_get_contents($routeFile);

    expect($content)->not->toBeFalse();
    expect($content)->toContain('/departments/weather/targets');
    expect($content)->toContain("requirePermission('departments_weather_targets_get')");
    expect($content)->toContain("requirePermission('departments_weather_targets_manage')");
    expect($content)->toContain("'department_access_:id'");
});

it('registers department weather hour details route with weather-read and department access checks', function (): void {
    $routeFile = app_path('routes/moduleWeatherAPIRoute.php');
    $content = file_get_contents($routeFile);

    expect($content)->not->toBeFalse();
    expect($content)->toContain('/departments/weather/hours/details');
    expect($content)->toContain("requirePermission('departments_weather_get')");
    expect($content)->toContain('parseDepartmentWeatherHourSlotFromRequest');
    expect($content)->toContain('loadDepartmentWeatherEmployeeHourDetailsByDepartment');
});

it('persists department weather targets using canonical department variable keys', function (): void {
    $routeFile = app_path('routes/moduleWeatherAPIRoute.php');
    $content = file_get_contents($routeFile);

    expect($content)->not->toBeFalse();
    expect($content)->toContain('weather_status_degraded_threshold');
    expect($content)->toContain('weather_status_healthy_threshold');
    expect($content)->toContain('loadDepartmentWeatherTargetsByDepartmentId');
    expect($content)->toContain('buildDepartmentWeatherTargetResponse');
});
