const express = require('express');
const router = express.Router();
const authController = require('../controllers/authController');
const authenticateToken = require('../middleware/authMiddleware');

// Validate token endpoint
router.get('/check-token', authenticateToken, authController.checkToken);

// Logout (invalidate current token)
router.post('/logout', authenticateToken, authController.logout);

// Registration endpoint
router.post('/register', authController.register);

// Verify email endpoint
router.post('/verify-email', authController.verifyEmail);

// Resend OTP endpoint
router.post('/resend-otp', authController.resendOTP);

// Login endpoint
router.post('/login', authController.login);

// Change password endpoint (requires authentication)
router.post('/change-password', authenticateToken, authController.changePassword);

module.exports = router;



