const express = require("express");
const { authenticate } = require("../middleware/login.middleware.js");
const {
  postUser,
  getUser,
  getUserById,
  updateUser,
  postLogin,
  deleteUser,
  checkAuth,
} = require("../controllers/user.controller.js");

const router = express.Router();

// Public routes
router.post("/Signup", postUser);
router.post("/Login", postLogin);

// Protected routes (authentication required)
router.get("/", getUser);
router.get("/check-auth", authenticate, checkAuth);
router.get("/:id", getUserById);
router.put("/:id", authenticate, updateUser);
router.delete("/:id", authenticate, deleteUser);

module.exports = router;

// https://api.artisticsheaven.com/api/user/