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

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

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

module.exports = router;
