import auth from "@/middlewares/auth";
import { Router } from "express";
import { Login, Register } from "@/controllers/account";
import {
    CreateSymptom,
    GetSymptoms,
    RepositionSymptom,
} from "@/controllers/symptom";
import { CreateDisease, GetDiseases } from "@/controllers/disease";
import {
    CreateUser,
    DeleteUser,
    GetUserById,
    GetUsers,
    UpdateUser,
} from "@/controllers/user";
import {
    CreatePatient,
    GetPatientById,
    GetPatientGrowthChart,
    GetPatients,
} from "@/controllers/patient";
import { CreateRule, GetRules } from "../controllers/rule";
import { CreateDiagnose, GetDiagnoseById } from "../controllers/diagnose";
import { GenerateDefaultData } from "../controllers/default";

const router = Router();

router.post("/account/register", Register);
router.post("/account/login", Login);

router.post("/users", auth, CreateUser);
router.get("/users", auth, GetUsers);
router.get("/users/:id", auth, GetUserById);
router.put("/users/:id", auth, UpdateUser);
router.delete("/users/:id", auth, DeleteUser);

router.post("/patients", auth, CreatePatient);
router.get("/patients", auth, GetPatients);
router.get("/patients/:id", auth, GetPatientById);

router.post("/symptoms", auth, CreateSymptom);
router.get("/symptoms", auth, GetSymptoms);
router.patch("/symptoms/:id/reposition", auth, RepositionSymptom);

router.post("/diseases", auth, CreateDisease);
router.get("/diseases", auth, GetDiseases);

router.post("/rules", auth, CreateRule);
router.get("/rules", auth, GetRules);

router.post("/diagnoses/:patient", auth, CreateDiagnose);
router.get("/diagnoses/:patient", auth, GetDiagnoseById);

router.get("/default", GenerateDefaultData);

router.get("/charts/patient-growth", auth, GetPatientGrowthChart);

export default router;
