// const authenticate = require("../../middlewares/authenticate")
// const authorize = require("../../middlewares/authorize")
// const express = require("express")
// const router = express.Router();
// const stockController = require("../../controllers/securityops/stockController")


// router.get("/dashboard", 
//     authenticate,
//     authorize(["admin", "inventory", "security", "qc"]) ,
//     (req, res) =>{
//         stockController.getStockDashboard(req, res);
//     }
// )

// router.get(
//   "/ledger",
//   authenticate,
//   authorize(["admin","inventory", "security", "qc"]),  (req, res) =>{
//      stockController.getStockLedgerByProduct(req, res);
//   }
// );


// module.exports = router;



const authenticate = require("../../middlewares/authenticate");
const authorize = require("../../middlewares/authorize");
const express = require("express");
const router = express.Router();
const stockController = require("../../controllers/inventory/stockController");

// Get stock dashboard (grouped by material name)
router.get(
  "/dashboard",
  authenticate,
  // authorize(["admin", "inventory", "security", "qc"]),
  stockController.getStockDashboard
);

// Get stock ledger for a specific material
router.get(
  "/ledger",
  authenticate,
  // authorize(["admin", "inventory", "security", "qc"]),
  stockController.getStockLedgerByProduct
);

// Get all unique material names in stock
router.get(
  "/materials",
  authenticate,
  // authorize(["admin", "inventory", "security", "qc"]),
  stockController.getStockMaterials
);


// Get stock by PO number
router.get(
  "/by-po/:po_number",
  authenticate,
  // authorize(["admin", "inventory", "security", "qc"]),
  stockController.getStockByPONumber
);

// Add these routes to your inventory routes file
router.get('/stock-by-warehouse/:warehouseId', stockController.getStockByWarehouse);
router.get('/warehouse-stock-summary', stockController.getWarehouseStockSummary);

module.exports = router;