/**
 * ==========================================================
 * Smart Attendance System
 * Authentication Routes
 * ==========================================================
 */

const express = require("express");

const router = express.Router();

const AuthController =
require("../controller/auth.controller");

const authMiddleware =
require("../middleware/auth.middleware");

/**
 * ======================================================
 * Public Routes
 * ======================================================
 */

// Login
router.post(

    "/login",

    AuthController.login

);

/**
 * ======================================================
 * Protected Routes
 * ======================================================
 */

// Current Logged User
router.get(

    "/me",

    authMiddleware,

    AuthController.me

);

// Change Password
router.put(

    "/change-password",

    authMiddleware,

    AuthController.changePassword

);

// Logout
router.post(

    "/logout",

    authMiddleware,

    AuthController.logout

);

module.exports = router;