import { Router } from "express";
import { EventController, authenticate } from "../controllers";

export function createEventRoutes(eventController: EventController): Router {
  const router = Router();

  router.use(authenticate);

  router.post("/", (req, res) => eventController.create(req, res));
  router.get("/", (req, res) => eventController.getAll(req, res));
  router.get("/range", (req, res) => eventController.getByDateRange(req, res));
  router.get("/:id", (req, res) => eventController.getById(req, res));
  router.put("/:id", (req, res) => eventController.update(req, res));
  router.delete("/:id", (req, res) => eventController.delete(req, res));

  return router;
}
