const express = require('express');
const router = express.Router();
const adminController = require('../controllers/adminController');
const verifyAccessTokenMiddleware = require('../middleware/verifyAccessToken');

/**
 * Public Routes (No Authentication Required)
 */

// Register new admin
router.post('/register', adminController.register);

// Login admin
router.post('/login', adminController.login);

/**
 * Protected Routes (Authentication Required)
 */

// Refresh access token
router.post('/refresh', adminController.refresh);

// Logout admin
router.post('/logout', verifyAccessTokenMiddleware, adminController.logout);

// Get all admins (superadmin only)
router.get('/', verifyAccessTokenMiddleware, adminController.getAll);

module.exports = router;
