import { Router } from "express";
import { authenticateToken } from "../middleware/authMiddleware";
import {
  createWorkProcesses,
  syncWorkInstructions,
  controlTimer,
  controlGroupTimer,
  getDefectTypes,
  saveResult,
  confirmResult,
  getResultHistory,
  getAvailableQty,
  acceptProcess,
  cancelAccept,
  getWarehouses,
  getWarehouseLocations,
  isLastProcess,
  updateTargetWarehouse,
  inventoryInbound,
  quickInventoryInbound,
  getReworkHistory,
  getBomMaterials,
  saveMaterialInput,
  getMaterialInputs,
  getChecklistItems,
} from "../controllers/popProductionController";

const router = Router();

router.use(authenticateToken);

router.post("/create-work-processes", createWorkProcesses);
router.post("/sync-work-instructions", syncWorkInstructions);
router.post("/timer", controlTimer);
router.post("/group-timer", controlGroupTimer);
router.get("/defect-types", getDefectTypes);
router.post("/save-result", saveResult);
router.post("/confirm-result", confirmResult);
router.get("/result-history", getResultHistory);
router.get("/available-qty", getAvailableQty);
router.post("/accept-process", acceptProcess);
router.post("/cancel-accept", cancelAccept);
router.get("/warehouses", getWarehouses);
router.get("/warehouse-locations/:warehouseId", getWarehouseLocations);
router.get("/is-last-process/:processId", isLastProcess);
router.post("/update-target-warehouse", updateTargetWarehouse);
router.post("/inventory-inbound", inventoryInbound);
router.post("/quick-inventory-inbound", quickInventoryInbound);
router.get("/rework-history/:woId", getReworkHistory);
router.get("/bom-materials/:processId", getBomMaterials);
router.post("/material-input", saveMaterialInput);
router.get("/material-inputs/:processId", getMaterialInputs);
router.get("/checklist-items/:processId", getChecklistItems);

export default router;
