<?php

declare(strict_types=1);

use App\Core\Middleware\AuthMiddleware;
use App\Core\Middleware\CsrfMiddleware;
use App\Controllers\PurchaseInvoiceController;
use App\Controllers\PurchaseReturnController;
use App\Controllers\SupplierPaymentController;

$router->get('/purchases/invoices', static function (): void { (new PurchaseInvoiceController())->index(); }, [new AuthMiddleware()]);
$router->get('/purchases/invoices/form', static function (): void { (new PurchaseInvoiceController())->form(); }, [new AuthMiddleware()]);
$router->post('/purchases/invoices/form', static function (): void { (new PurchaseInvoiceController())->form(); }, [new AuthMiddleware(), new CsrfMiddleware()]);
$router->get('/purchases/invoices/view', static function (): void { (new PurchaseInvoiceController())->view(); }, [new AuthMiddleware()]);
$router->post('/purchases/invoices/view', static function (): void { (new PurchaseInvoiceController())->view(); }, [new AuthMiddleware(), new CsrfMiddleware()]);

$router->get('/purchases/returns', static function (): void { (new PurchaseReturnController())->index(); }, [new AuthMiddleware()]);
$router->get('/purchases/returns/form', static function (): void { (new PurchaseReturnController())->form(); }, [new AuthMiddleware()]);
$router->post('/purchases/returns/form', static function (): void { (new PurchaseReturnController())->form(); }, [new AuthMiddleware(), new CsrfMiddleware()]);
$router->get('/purchases/returns/view', static function (): void { (new PurchaseReturnController())->view(); }, [new AuthMiddleware()]);
$router->post('/purchases/returns/view', static function (): void { (new PurchaseReturnController())->view(); }, [new AuthMiddleware(), new CsrfMiddleware()]);

$router->get('/purchases/supplier-payments', static function (): void { (new SupplierPaymentController())->index(); }, [new AuthMiddleware()]);
$router->get('/purchases/supplier-payments/form', static function (): void { (new SupplierPaymentController())->form(); }, [new AuthMiddleware()]);
$router->post('/purchases/supplier-payments/form', static function (): void { (new SupplierPaymentController())->form(); }, [new AuthMiddleware(), new CsrfMiddleware()]);
$router->get('/purchases/supplier-payments/view', static function (): void { (new SupplierPaymentController())->view(); }, [new AuthMiddleware()]);
$router->post('/purchases/supplier-payments/view', static function (): void { (new SupplierPaymentController())->view(); }, [new AuthMiddleware(), new CsrfMiddleware()]);
$router->get('/purchases/supplier-payments/statement', static function (): void { (new SupplierPaymentController())->statement(); }, [new AuthMiddleware()]);
$router->get('/purchases/supplier-payments/aging', static function (): void { (new SupplierPaymentController())->aging(); }, [new AuthMiddleware()]);
