<?php

it('registers collected-invoice economic pdf download with draft and booked support', function (): void {
    $routeFile = app_path('routes/orderInvoicesRoute.php');
    $content = file_get_contents($routeFile);

    expect($content)->not->toBeFalse();
    expect($content)->toContain('/collected-invoices/economic/pdf');
    expect($content)->toContain("requirePermission('download_collected_invoice_economic_pdf')");
    expect($content)->toContain("self::requireParameters(['type'])");
    expect($content)->toContain('downloadCollectedEconomicInvoicePdf');
    expect($content)->toContain('getInvoiceDraftId()');
    expect($content)->toContain('getInvoiceBookedId()');
});

it('supports draft and booked pdf downloads in the e-conomic pdf endpoint wrapper', function (): void {
    $endpointFile = app_path('modules/economic/endpoints/invoices/economic_invoices_pdf_endpoint.php');
    $content = file_get_contents($endpointFile);

    expect($content)->not->toBeFalse();
    expect($content)->toContain('function getBooked(int $id): string');
    expect($content)->toContain('function getDraft(int $id): string');
    expect($content)->toContain("'/invoices/booked/' . \$id . '/pdf'");
    expect($content)->toContain("'/invoices/drafts/' . \$id . '/pdf'");
});
