<?php
declare(strict_types=1);

/** @var \App\Core\Router $router */

use App\Middleware\AuthMiddleware;
use App\Middleware\TenantMiddleware;

$mw = [AuthMiddleware::class, TenantMiddleware::class];

$router->get('/invoices', 'InvoiceController@index', $mw);
$router->post('/invoices', 'InvoiceController@store', $mw);
$router->get('/invoices/next-number', 'InvoiceController@nextNumber', $mw);
$router->post('/invoices/calculate', 'InvoiceController@calculate', $mw);

$router->get('/invoices/{id}', 'InvoiceController@show', $mw);
$router->put('/invoices/{id}', 'InvoiceController@update', $mw);
$router->delete('/invoices/{id}', 'InvoiceController@destroy', $mw);

$router->post('/invoices/{id}/cancel', 'InvoiceController@cancel', $mw);
$router->post('/invoices/{id}/clone', 'InvoiceController@duplicate', $mw);

$router->get('/invoices/{id}/pdf', 'InvoiceController@pdf', $mw);
$router->post('/invoices/{id}/send', 'InvoiceController@send', $mw);
$router->post('/invoices/{id}/reminder', 'InvoiceController@reminder', $mw);

$router->post('/invoices/{id}/payment', 'InvoiceController@recordPayment', $mw);
$router->get('/invoices/{id}/payments', 'InvoiceController@getPayments', $mw);

$router->get('/invoices/{id}/view', 'InvoiceController@viewPublic');
