import { Router } from "express";
import barcodeLabelController from "../controllers/barcodeLabelController";
import { authenticateToken } from "../middleware/authMiddleware";

const router = Router();

router.use(authenticateToken);

router.get("/", (req, res, next) =>
  barcodeLabelController.getLabels(req, res, next)
);
router.get("/templates", (req, res, next) =>
  barcodeLabelController.getTemplates(req, res, next)
);
router.get("/templates/:templateId", (req, res, next) =>
  barcodeLabelController.getTemplateById(req, res, next)
);
router.post("/", (req, res, next) =>
  barcodeLabelController.createLabel(req, res, next)
);

router.get("/:labelId", (req, res, next) =>
  barcodeLabelController.getLabelById(req, res, next)
);
router.get("/:labelId/layout", (req, res, next) =>
  barcodeLabelController.getLayout(req, res, next)
);
router.put("/:labelId", (req, res, next) =>
  barcodeLabelController.updateLabel(req, res, next)
);
router.put("/:labelId/layout", (req, res, next) =>
  barcodeLabelController.saveLayout(req, res, next)
);
router.delete("/:labelId", (req, res, next) =>
  barcodeLabelController.deleteLabel(req, res, next)
);
router.post("/:labelId/copy", (req, res, next) =>
  barcodeLabelController.copyLabel(req, res, next)
);

export default router;
