const express = require("express");
const router = express.Router();

const { requireLogin, requireAdmin } = require("../middleware/auth.middleware");
const {
  listServices,
  showCreateService,
  createService,
  updateServicePrice,
  toggleService,
  listOpenServices,
  showServiceLogs,
  listServicesAdmin
} = require("../controllers/service.controller");

router.get("/", requireLogin, listServicesAdmin);
router.get("/", requireAdmin, listServices);
router.get("/create", requireAdmin, showCreateService);
router.post("/create", requireAdmin, createService);
router.post("/:id/update-price", requireAdmin, updateServicePrice);
router.post("/:id/toggle", requireAdmin, toggleService);
router.get("/open", requireLogin, listOpenServices);
router.get("/logs", requireAdmin, showServiceLogs);


module.exports = router;
