<?php

use App\Http\Controllers\DocumentExportController;
use App\Http\Controllers\LoanDocumentReviewController;
use Illuminate\Support\Facades\Route;

Route::middleware('auth')->group(function (): void {
    Route::get('/document-branding/{business}/{asset}', [DocumentExportController::class, 'branding'])
        ->where('asset', 'logo|stamp')
        ->name('document-branding.asset');

    Route::get('/loans/{loan}/documents/{document}/review', LoanDocumentReviewController::class)
        ->middleware(['permission:loans.view','can:view,loan'])->name('loans.documents.review');

    Route::get('/loans/{loan}/agreement/print', [DocumentExportController::class, 'loanAgreementPrint'])
        ->middleware(['permission:loans.view','can:view,loan'])->name('documents.loan-agreement.print');
    Route::get('/loan-payments/{payment}/receipt.pdf', [DocumentExportController::class, 'paymentReceiptPdf'])
        ->middleware(['permission:loans.view','can:view,payment'])->name('documents.payment-receipt.pdf');
    Route::get('/loans/{loan}/statement.pdf', [DocumentExportController::class, 'loanStatementPdf'])
        ->middleware(['permission:loans.view','can:view,loan'])->name('documents.loan-statement.pdf');
    Route::get('/collateral/{collateral}/receipt.pdf', [DocumentExportController::class, 'collateralReceiptPdf'])
        ->middleware(['permission:collateral.view','can:view,collateral'])->name('documents.collateral-receipt.pdf');
    Route::get('/collateral/{collateral}/release-acknowledgement.pdf', [DocumentExportController::class, 'collateralReleasePdf'])
        ->middleware(['permission:collateral.view','can:view,collateral'])->name('documents.collateral-release.pdf');
    Route::get('/loan-disbursements/{disbursement}/receipt.pdf', [DocumentExportController::class, 'disbursementReceiptPdf'])
        ->middleware(['permission:loans.view','can:view,disbursement'])->name('documents.disbursement-receipt.pdf');
    Route::get('/expenses/{expense}/voucher', [DocumentExportController::class, 'expenseVoucherPrint'])
        ->middleware(['permission:expenses.view','can:view,expense'])->name('documents.expense-voucher.print');
    Route::get('/expenses/{expense}/voucher.pdf', [DocumentExportController::class, 'expenseVoucherPdf'])
        ->middleware(['permission:expenses.view','can:view,expense'])->name('documents.expense-voucher.pdf');
});
