/**
 * 절단계획 라우트
 */

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

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

// 조회 소스
router.get("/materials",     ctrl.getMaterials);     // 원자재 목록
router.get("/items",         ctrl.searchItems);      // 품목 검색
router.get("/orders",        ctrl.getOrders);        // 수주 목록

// 계획
router.get("/next-plan-no",  ctrl.nextPlanNo);
router.get("/plans",         ctrl.getPlans);
router.get("/plans/:id",     ctrl.getPlanDetail);
router.post("/plans",        ctrl.savePlan);
router.put("/plans/:id",     ctrl.savePlan);         // id는 body에 담겨오거나 경로로
router.delete("/plans/:id",  ctrl.deletePlan);

export default router;
