<?php
declare(strict_types=1);

use App\Modules\Procurement\Controllers\ProcurementDashboardController;
use App\Modules\Procurement\Controllers\RequisitionController;
use App\Modules\Procurement\Controllers\GoodsReceivedNoteController;
use App\Modules\Procurement\Controllers\VendorInvoiceController;
use App\Modules\Procurement\Controllers\VendorPaymentController;
use App\Modules\Procurement\Controllers\ReturnToVendorController;
use App\Modules\Procurement\Controllers\ProcurementReportController;

return [
    // ── Dashboard ──
    ['GET',  '/procurement',                                  ProcurementDashboardController::class . '@index',    ['auth'], 'procurement.dashboard'],

    // ── Purchase Requisitions ──
    ['GET',  '/procurement/requisitions',                     RequisitionController::class . '@index',             ['auth'], 'procurement.pr.view'],
    ['GET',  '/procurement/requisitions/create',              RequisitionController::class . '@create',            ['auth'], 'procurement.pr.create'],
    ['POST', '/procurement/requisitions',                     RequisitionController::class . '@store',             ['auth', 'csrf'], 'procurement.pr.create'],
    ['GET',  '/procurement/requisitions/{id}',                RequisitionController::class . '@show',              ['auth'], 'procurement.pr.view'],
    ['GET',  '/procurement/requisitions/{id}/edit',           RequisitionController::class . '@edit',              ['auth'], 'procurement.pr.create'],
    ['POST', '/procurement/requisitions/{id}/update',         RequisitionController::class . '@update',            ['auth', 'csrf'], 'procurement.pr.create'],
    ['POST', '/procurement/requisitions/{id}/submit',         RequisitionController::class . '@submit',            ['auth', 'csrf'], 'procurement.pr.create'],
    ['POST', '/procurement/requisitions/{id}/approve',        RequisitionController::class . '@approve',           ['auth', 'csrf'], 'procurement.pr.approve'],
    ['POST', '/procurement/requisitions/{id}/reject',         RequisitionController::class . '@reject',            ['auth', 'csrf'], 'procurement.pr.approve'],
    ['POST', '/procurement/requisitions/{id}/convert',        RequisitionController::class . '@convert',           ['auth', 'csrf'], 'procurement.pr.convert'],
    ['POST', '/procurement/requisitions/{id}/cancel',         RequisitionController::class . '@cancel',            ['auth', 'csrf'], 'procurement.pr.create'],

    // ── Goods Received Notes ──
    ['GET',  '/procurement/grn',                              GoodsReceivedNoteController::class . '@index',       ['auth'], 'procurement.grn.view'],
    ['GET',  '/procurement/grn/create',                       GoodsReceivedNoteController::class . '@create',      ['auth'], 'procurement.grn.create'],
    ['POST', '/procurement/grn',                              GoodsReceivedNoteController::class . '@store',       ['auth', 'csrf'], 'procurement.grn.create'],
    ['GET',  '/procurement/grn/{id}',                         GoodsReceivedNoteController::class . '@show',        ['auth'], 'procurement.grn.view'],
    ['GET',  '/procurement/grn/{id}/inspect',                 GoodsReceivedNoteController::class . '@inspectForm', ['auth'], 'procurement.grn.inspect'],
    ['POST', '/procurement/grn/{id}/inspect',                 GoodsReceivedNoteController::class . '@inspect',     ['auth', 'csrf'], 'procurement.grn.inspect'],
    ['POST', '/procurement/grn/{id}/cancel',                  GoodsReceivedNoteController::class . '@cancel',      ['auth', 'csrf'], 'procurement.grn.create'],

    // ── Vendor Invoices ──
    ['GET',  '/procurement/invoices',                         VendorInvoiceController::class . '@index',           ['auth'], 'procurement.invoice.view'],
    ['GET',  '/procurement/invoices/create',                  VendorInvoiceController::class . '@create',          ['auth'], 'procurement.invoice.create'],
    ['POST', '/procurement/invoices',                         VendorInvoiceController::class . '@store',           ['auth', 'csrf'], 'procurement.invoice.create'],
    ['GET',  '/procurement/invoices/{id}',                    VendorInvoiceController::class . '@show',            ['auth'], 'procurement.invoice.view'],
    ['GET',  '/procurement/invoices/{id}/edit',               VendorInvoiceController::class . '@edit',            ['auth'], 'procurement.invoice.create'],
    ['POST', '/procurement/invoices/{id}/update',             VendorInvoiceController::class . '@update',          ['auth', 'csrf'], 'procurement.invoice.create'],
    ['POST', '/procurement/invoices/{id}/verify',             VendorInvoiceController::class . '@verify',          ['auth', 'csrf'], 'procurement.invoice.create'],
    ['POST', '/procurement/invoices/{id}/approve',            VendorInvoiceController::class . '@approve',         ['auth', 'csrf'], 'procurement.invoice.approve'],
    ['POST', '/procurement/invoices/{id}/cancel',             VendorInvoiceController::class . '@cancel',          ['auth', 'csrf'], 'procurement.invoice.approve'],
    ['GET',  '/procurement/invoices/{id}/match',              VendorInvoiceController::class . '@matchView',       ['auth'], 'procurement.invoice.view'],

    // ── Vendor Payments ──
    ['GET',  '/procurement/payments',                         VendorPaymentController::class . '@index',           ['auth'], 'procurement.payment.view'],
    ['GET',  '/procurement/payments/create',                  VendorPaymentController::class . '@create',          ['auth'], 'procurement.payment.create'],
    ['POST', '/procurement/payments',                         VendorPaymentController::class . '@store',           ['auth', 'csrf'], 'procurement.payment.create'],
    ['GET',  '/procurement/payments/{id}',                    VendorPaymentController::class . '@show',            ['auth'], 'procurement.payment.view'],
    ['POST', '/procurement/payments/{id}/approve',            VendorPaymentController::class . '@approve',         ['auth', 'csrf'], 'procurement.payment.approve'],
    ['POST', '/procurement/payments/{id}/complete',           VendorPaymentController::class . '@complete',        ['auth', 'csrf'], 'procurement.payment.approve'],
    ['POST', '/procurement/payments/{id}/void',               VendorPaymentController::class . '@void',            ['auth', 'csrf'], 'procurement.payment.approve'],

    // ── Return to Vendor ──
    ['GET',  '/procurement/rtv',                              ReturnToVendorController::class . '@index',          ['auth'], 'procurement.rtv.view'],
    ['GET',  '/procurement/rtv/create',                       ReturnToVendorController::class . '@create',         ['auth'], 'procurement.rtv.create'],
    ['POST', '/procurement/rtv',                              ReturnToVendorController::class . '@store',          ['auth', 'csrf'], 'procurement.rtv.create'],
    ['GET',  '/procurement/rtv/{id}',                         ReturnToVendorController::class . '@show',           ['auth'], 'procurement.rtv.view'],
    ['GET',  '/procurement/rtv/{id}/edit',                    ReturnToVendorController::class . '@edit',           ['auth'], 'procurement.rtv.create'],
    ['POST', '/procurement/rtv/{id}/update',                  ReturnToVendorController::class . '@update',         ['auth', 'csrf'], 'procurement.rtv.create'],
    ['POST', '/procurement/rtv/{id}/submit',                  ReturnToVendorController::class . '@submit',         ['auth', 'csrf'], 'procurement.rtv.create'],
    ['POST', '/procurement/rtv/{id}/approve',                 ReturnToVendorController::class . '@approve',        ['auth', 'csrf'], 'procurement.rtv.approve'],
    ['POST', '/procurement/rtv/{id}/ship',                    ReturnToVendorController::class . '@ship',           ['auth', 'csrf'], 'procurement.rtv.manage'],
    ['POST', '/procurement/rtv/{id}/complete',                ReturnToVendorController::class . '@complete',       ['auth', 'csrf'], 'procurement.rtv.manage'],
    ['POST', '/procurement/rtv/{id}/cancel',                  ReturnToVendorController::class . '@cancel',         ['auth', 'csrf'], 'procurement.rtv.create'],

    // ── Supplier Price Quotes ──
    ['GET',  '/procurement/quotes',                              'Procurement\Controllers\QuoteController@index',             ['auth'], 'procurement.quote.view'],
    ['GET',  '/procurement/quotes/request',                      'Procurement\Controllers\QuoteController@createRequest',     ['auth'], 'procurement.quote.create'],
    ['POST', '/procurement/quotes/request',                      'Procurement\Controllers\QuoteController@storeRequest',      ['auth', 'csrf'], 'procurement.quote.create'],
    ['GET',  '/procurement/quotes/{id:\d+}/response',            'Procurement\Controllers\QuoteController@recordResponse',    ['auth'], 'procurement.quote.create'],
    ['POST', '/procurement/quotes/{id:\d+}/response',            'Procurement\Controllers\QuoteController@storeResponse',     ['auth', 'csrf'], 'procurement.quote.create'],
    ['GET',  '/procurement/quotes/compare',                      'Procurement\Controllers\QuoteController@compare',           ['auth'], 'procurement.quote.evaluate'],
    ['POST', '/procurement/quotes/evaluate',                     'Procurement\Controllers\QuoteController@evaluate',          ['auth', 'csrf'], 'procurement.quote.evaluate'],
    ['POST', '/procurement/quotes/evaluations/{id:\d+}/convert', 'Procurement\Controllers\QuoteController@convertToPo',      ['auth', 'csrf'], 'procurement.pr.convert'],

    // ── Delivery Tracking & Reports ──
    ['GET',  '/procurement/reports/overdue-deliveries',           'Procurement\Controllers\DeliveryTrackingController@overdueDeliveries', ['auth'], 'procurement.report'],
    ['GET',  '/procurement/reports/po-balance',                   'Procurement\Controllers\DeliveryTrackingController@poBalance',         ['auth'], 'procurement.report'],
    ['GET',  '/procurement/reports/price-deviation',              'Procurement\Controllers\DeliveryTrackingController@priceDeviation',    ['auth'], 'procurement.report'],

    // ── Reports ──
    ['GET',  '/procurement/reports/purchase-volume',          ProcurementReportController::class . '@purchaseVolume',       ['auth'], 'procurement.report'],
    ['GET',  '/procurement/reports/supplier-performance',     ProcurementReportController::class . '@supplierPerformance',  ['auth'], 'procurement.report'],
    ['GET',  '/procurement/reports/match-status',             ProcurementReportController::class . '@matchStatus',          ['auth'], 'procurement.report'],
    ['GET',  '/procurement/reports/overdue-invoices',         ProcurementReportController::class . '@overdueInvoices',      ['auth'], 'procurement.report'],
];
