<?php

it('wires the order booking completion confirmation resend endpoint', function (): void {
    $routeFile = app_path('routes/orderBookingRoute.php');

    expect(is_file($routeFile))->toBeTrue();

    $routeCode = preg_replace('/\s+/', ' ', (string)file_get_contents($routeFile));

    expect($routeCode)
        ->toContain("$" . "this->post('/order-bookings/completion-confirmation/resend', function () {")
        ->toContain("self::requirePermission('complete_bookings');")
        ->toContain('self::requireDepartmentAccess((int)$object->department->value());')
        ->toContain('(new email())->sendWashCertificateEmailToCustomer($object);')
        ->toContain("'Completion confirmation resent successfully.'");
});
