<?php

it('wires complaint create, lookup, list, edit, and delete routes with validation and parsing', function (): void {
    $content = (string)file_get_contents(app_path('routes/departmentDailyReportsRoute.php'));

    expect($content)->toContain('/departments/daily-reports/complaints');
    expect($content)->toContain('/departments/daily-reports/complaints/customers');
    expect($content)->toContain("requirePermission('create_department_daily_report_complaints')");
    expect($content)->toContain("requirePermission('list_department_daily_report_complaints')");
    expect($content)->toContain("requirePermission('edit_department_daily_report_complaints')");
    expect($content)->toContain("requirePermission('delete_department_daily_report_complaints')");
    expect($content)->toContain("hasPermission('create_department_daily_report_complaints')");
    expect($content)->toContain("hasPermission('edit_department_daily_report_complaints')");
    expect($content)->toContain("requireDepartmentAccess((int)self::getParameter('department_id'))");
    expect($content)->toContain('requireDepartmentAccess((int)$complaint->department_id->value())');
    expect($content)->toContain("'department_id' => \$user->getGroup()->getDepartments()");
    expect($content)->toContain("getOrImportCustomerByCustomerNumber");
    expect($content)->toContain("Search must be at least 2 characters");
    expect($content)->toContain("Failed to fetch complaint customers from e-conomic");
    expect($content)->toContain("Wash date is required");
    expect($content)->toContain("Category is required");
    expect($content)->toContain("Invalid complaint category");
    expect($content)->toContain("Description is required");
    expect($content)->toContain("requireComplaintWashDateParameter");
    expect($content)->toContain("requireComplaintCategoryParameter");
    expect($content)->toContain("dailyReportComplaintsRepository()->addComplaint");
    expect($content)->toContain("Complaint not found");
    expect($content)->toContain("Complaint deleted successfully");
    expect($content)->toContain("parseComplaint");
    expect($content)->toContain("listObjectsWithPaginationIfSet");
    expect($content)->toContain("countForDepartmentsInRange");
});
