/**
 * ECR(Engineering Change Request) 관리 라우트
 *  - 모두 로그인 필수
 */
import { Router } from "express";
import { authenticateToken } from "../middleware/authMiddleware";
import { EcrMngController } from "../controllers/ecrMngController";

const router = Router();

// 옵션 조회 (드롭다운용) — 동적 라우트보다 먼저 등록
router.get("/options/writers", authenticateToken, EcrMngController.writerOptions);
router.get("/options/products", authenticateToken, EcrMngController.productOptions);
router.get("/options/parts", authenticateToken, EcrMngController.partOptions);
router.get("/options/codes/:parentCodeId", authenticateToken, EcrMngController.commCodeOptions);

// 목록/상세/머지/삭제
router.get("/", authenticateToken, EcrMngController.list);
router.get("/:objId", authenticateToken, EcrMngController.detail);
router.post("/", authenticateToken, EcrMngController.merge);
router.post("/:objId/complete", authenticateToken, EcrMngController.complete);
router.delete("/", authenticateToken, EcrMngController.remove);

export default router;
