<?php
/**
 * Controller Home - Page d'accueil
 * mySupport - Plateforme de Service Client Intelligent
 */

namespace App\Controllers;

class HomeController
{
    public function index(): void
    {
        if (isset($_SESSION['user_id']) && isset($_SESSION['user_role'])) {
            switch ($_SESSION['user_role']) {
                case ROLE_SUPER_ADMIN:
                    header("Location: " . BASE_URL . "/super-admin");
                    exit;
                case ROLE_ADMIN_ENTREPRISE:
                    header("Location: " . BASE_URL . "/admin");
                    exit;
                case ROLE_AGENT:
                    header("Location: " . BASE_URL . "/agent");
                    exit;
            }
        }
        
        // Afficher la page d'accueil directement
        include VIEWS_PATH . '/home/index.php';
    }
}
