<?php

it('wires outside-hours summary and trend endpoints through the dedicated statistics service', function (): void {
    $routeFile = app_path('routes/departmentDailyReportsRoute.php');
    $content = file_get_contents($routeFile);

    expect($content)->not->toBeFalse();
    expect($content)->toContain('use classes\department_outside_hours_statistics_service;');
    expect($content)->toContain('/departments/daily-reports/transaction-count');
    expect($content)->toContain("'outside_hours' => \$outside_hours_service->getSummary(");
    expect($content)->toContain("/departments/daily-reports/outside-hours-trend");
    expect($content)->toContain("outsideHoursStatisticsService()->getTrend(");
    expect($content)->toContain("normalizeDepartmentIdsParameter(self::getParameter('department_ids'))");
    expect($content)->toContain('protected function outsideHoursStatisticsService(): department_outside_hours_statistics_service');
});

it('initializes the outside-hours statistics service before building the transaction-count summary payload', function (): void {
    $routeFile = app_path('routes/departmentDailyReportsRoute.php');
    $content = file_get_contents($routeFile);

    expect($content)->not->toBeFalse();
    expect($content)->toMatch(
        "/\\/departments\\/daily-reports\\/transaction-count'.*?\\\$outside_hours_service = \\\$this->outsideHoursStatisticsService\\(\\);.*?'outside_hours' => \\\$outside_hours_service->getSummary\\(/s"
    );
});
