<?php
namespace Controllers;

use Core\Controller;
use Core\Session;

class DashboardController extends Controller {
    public function index(): void {
        $this->requireAuth();
        $user = $this->currentUser();
        match($user['role']) {
            'super-admin', 'admin' => $this->redirect('admin/dashboard'),
            'teacher'              => $this->redirect('teacher/dashboard'),
            'student'              => $this->redirect('student/dashboard'),
            'parent'               => $this->redirect('parent/dashboard'),
            default                => $this->redirect('login'),
        };
    }
}
