const express = require('express');
const router = express.Router();
const { authenticate } = require('../middlewares/auth');

const bomReportController = require('../controllers/bomReportController');
const materialMasterReportController = require('../controllers/materialMasterReportController');
const businessPartnerReportController = require('../controllers/businessPartnerReportController');
const approvedSuppliersListReportController = require('../controllers/approvedSuppliersListReportController');
const approvedSuppliersReportController = require('../controllers/approvedSuppliersReportController');
const purchaseOrderRegisterReportController = require('../controllers/purchaseOrderRegisterReportController');
const goodsReceiptRegisterReportController = require('../controllers/goodsReceiptRegisterReportController');
const vendorInvoiceRegisterReportController = require('../controllers/vendorInvoiceRegisterReportController');
const purchaseRequisitionRegisterReportController = require('../controllers/purchaseRequisitionRegisterReportController');
const detailedPurchaseRequisitionReportController = require('../controllers/detailedPurchaseRequisitionReportController');
const productionOrderRegisterReportController = require('../controllers/productionOrderRegisterReportController');
const productionConfirmationRegisterReportController = require('../controllers/productionConfirmationRegisterReportController');
const scrapReportRegisterReportController = require('../controllers/scrapReportRegisterReportController');

router.use(authenticate);

// BOM Report routes
router.get('/bom', bomReportController.getBOMReport);

// Material Master Report routes
router.get('/material-master', materialMasterReportController.getMaterialMasterReport);

// Business Partner Report routes
router.get('/business-partner', businessPartnerReportController.getBusinessPartnerReport);

// Approved Suppliers Report (list + PDF)
router.get('/approved-suppliers', approvedSuppliersListReportController.getApprovedSuppliersReport);
router.get('/approved-suppliers/pdf', approvedSuppliersReportController.generatePDF);

// Purchase Order Register Report
router.get('/purchase-order-register', purchaseOrderRegisterReportController.getPurchaseOrderRegisterReport);

// Goods Receipt Register Report (GRN)
router.get('/goods-receipt-register', goodsReceiptRegisterReportController.getGoodsReceiptRegisterReport);

// Vendor Invoice Register Report
router.get('/vendor-invoice-register', vendorInvoiceRegisterReportController.getVendorInvoiceRegisterReport);

// Purchase Requisition Register Report
router.get('/purchase-requisition-register', purchaseRequisitionRegisterReportController.getPurchaseRequisitionRegisterReport);

// Detailed Purchase Requisition Report (line-level)
router.get('/detailed-purchase-requisition', detailedPurchaseRequisitionReportController.getDetailedPurchaseRequisitionReport);

// Production Order Register Report
router.get('/production-order-register', productionOrderRegisterReportController.getProductionOrderRegisterReport);

// Production Confirmation Register Report
router.get('/production-confirmation-register', productionConfirmationRegisterReportController.getProductionConfirmationRegisterReport);

// Scrap Report Register Report
router.get('/scrap-register', scrapReportRegisterReportController.getScrapReportRegisterReport);

module.exports = router;

