const express = require("express");
const router = express.Router();
const authorize = require("../../../../middlewares/authorize-sapps");
const assetStatusLabelService = require("./assetStatusLabel.service");

router.post("/create", authorize(), (req, res, next) => assetStatusLabelService.create(req.body).then((r) => res.json(r)).catch(next));
router.post("/", authorize(), (req, res, next) => assetStatusLabelService.getAll(req.body).then((r) => res.json(r)).catch(next));
router.post("/option", authorize(), (req, res, next) => assetStatusLabelService.option(req.body).then((r) => res.json(r)).catch(next));
router.get("/count", authorize(), (req, res, next) => assetStatusLabelService.count(req.query).then((r) => res.json(r)).catch(next));
router.put("/:id", authorize(), (req, res, next) => assetStatusLabelService.update(req.params.id, req.body).then((r) => res.json(r)).catch(next));
router.put("/enabled/:id", authorize(), (req, res, next) => assetStatusLabelService.enabled(req.params.id, req.body).then((r) => res.json(r)).catch(next));
router.delete("/:id", authorize(), (req, res, next) => assetStatusLabelService.delete(req.params.id).then((r) => res.json(r)).catch(next));

module.exports = router;
