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

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

module.exports = router;
