<?php
/**
 * ============================================================================
 * FILE 1: dashboard/index.php
 * ============================================================================
 */
?>
<?php
define('AIMS_ACCESS', true);
require_once '../config/config.php';

// Require login
requireLogin();

// Route to appropriate dashboard based on user type
$userType = getUserType();

switch ($userType) {
    case 'farmer':
        require_once 'farmer-dashboard.php';
        break;
    
    case 'buyer':
        require_once 'buyer-dashboard.php';
        break;
    
    case 'extension_officer':
        require_once 'extension-dashboard.php';
        break;
    
    case 'admin':
        header('Location: ' . APP_URL . '/admin/');
        exit();
        break;
    
    default:
        require_once 'farmer-dashboard.php';
        break;
}
?>