const express = require('express');
const router = express.Router();
const adminAuthController = require('../controllers/adminAuthController');
const { authenticateAdmin } = require('../middleware/auth');
const { logAdminOperation } = require('../middleware/adminLogger');

/**
 * Admin Authentication Routes
 * Base path: /api/v1/admin
 */

/**
 * @route   POST /api/v1/admin/login
 * @desc    Admin login
 * @access  Public
 */
router.post('/login', adminAuthController.login);

/**
 * @route   POST /api/v1/admin/refresh-token
 * @desc    Refresh admin access token
 * @access  Public
 */
router.post('/refresh-token', adminAuthController.refreshToken);

/**
 * @route   GET /api/v1/admin/profile
 * @desc    Get current admin profile
 * @access  Private (Admin)
 */
router.get('/profile', authenticateAdmin, logAdminOperation, adminAuthController.getProfile);

module.exports = router;
