<?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'], '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'], 'procurement.pr.create'],
    ['POST', '/procurement/requisitions/{id}/submit',         RequisitionController::class . '@submit',            ['auth'], 'procurement.pr.create'],
    ['POST', '/procurement/requisitions/{id}/approve',        RequisitionController::class . '@approve',           ['auth'], 'procurement.pr.approve'],
    ['POST', '/procurement/requisitions/{id}/reject',         RequisitionController::class . '@reject',            ['auth'], 'procurement.pr.approve'],
    ['POST', '/procurement/requisitions/{id}/convert',        RequisitionController::class . '@convert',           ['auth'], 'procurement.pr.convert'],
    ['POST', '/procurement/requisitions/{id}/cancel',         RequisitionController::class . '@cancel',            ['auth'], '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'], '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'], 'procurement.grn.inspect'],
    ['POST', '/procurement/grn/{id}/cancel',                  GoodsReceivedNoteController::class . '@cancel',      ['auth'], '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'], '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'], 'procurement.invoice.create'],
    ['POST', '/procurement/invoices/{id}/verify',             VendorInvoiceController::class . '@verify',          ['auth'], 'procurement.invoice.create'],
    ['POST', '/procurement/invoices/{id}/approve',            VendorInvoiceController::class . '@approve',         ['auth'], 'procurement.invoice.approve'],
    ['POST', '/procurement/invoices/{id}/cancel',             VendorInvoiceController::class . '@cancel',          ['auth'], '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'], 'procurement.payment.create'],
    ['GET',  '/procurement/payments/{id}',                    VendorPaymentController::class . '@show',            ['auth'], 'procurement.payment.view'],
    ['POST', '/procurement/payments/{id}/approve',            VendorPaymentController::class . '@approve',         ['auth'], 'procurement.payment.approve'],
    ['POST', '/procurement/payments/{id}/complete',           VendorPaymentController::class . '@complete',        ['auth'], 'procurement.payment.approve'],
    ['POST', '/procurement/payments/{id}/void',               VendorPaymentController::class . '@void',            ['auth'], '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'], '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'], 'procurement.rtv.create'],
    ['POST', '/procurement/rtv/{id}/submit',                  ReturnToVendorController::class . '@submit',         ['auth'], 'procurement.rtv.create'],
    ['POST', '/procurement/rtv/{id}/approve',                 ReturnToVendorController::class . '@approve',        ['auth'], 'procurement.rtv.approve'],
    ['POST', '/procurement/rtv/{id}/ship',                    ReturnToVendorController::class . '@ship',           ['auth'], 'procurement.rtv.manage'],
    ['POST', '/procurement/rtv/{id}/complete',                ReturnToVendorController::class . '@complete',       ['auth'], 'procurement.rtv.manage'],
    ['POST', '/procurement/rtv/{id}/cancel',                  ReturnToVendorController::class . '@cancel',         ['auth'], 'procurement.rtv.create'],

    // ── 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'],
];
