// ============================================================
// 자재관리 라우트 — 자재리스트(/list) + 불출의뢰서(/issue-request)
// app.ts: app.use("/api/inventory-mng", inventoryMngRoutes)
// ============================================================

import { Router } from "express";
import { authenticateToken } from "../middleware/authMiddleware";
import * as ctrl from "../controllers/inventoryMngController";

const router = Router();
router.use(authenticateToken);

// 자재리스트
router.get("/list",                    ctrl.getInventoryList);
router.post("/stock",                  ctrl.postInventoryStock);
router.post("/stock/delete",           ctrl.deleteInventoryStock);
router.post("/move",                   ctrl.postInventoryMove);
router.get("/history/:objid",          ctrl.getInventoryHistory);

// 불출의뢰서
router.get("/issue-request",                ctrl.getIssueRequestList);
router.get("/issue-request/:objid",         ctrl.getIssueRequestDetail);
router.post("/issue-request/candidates",    ctrl.getIssueRequestCandidates);
router.post("/issue-request",               ctrl.postIssueRequest);
router.delete("/issue-request/:objid",      ctrl.deleteIssueRequest);
router.post("/issue-request/receive",       ctrl.postIssueRequestReceive);
router.post("/issue-request/dispatch",      ctrl.postIssueRequestDispatch);

// 공통 옵션
router.get("/options/projects", ctrl.getProjectOptions);
router.get("/options/units",    ctrl.getUnitOptions);
router.get("/options/users",    ctrl.getUserOptions);
router.get("/options/parts",    ctrl.getPartOptions);

export default router;
