<?php
namespace App\Controllers;

class AdminRouteAliasController
{
    private function startSession(): void
    {
        if (session_status() !== PHP_SESSION_ACTIVE) {
            session_start();
        }
    }

    private function requireLogin(): void
    {
        $this->startSession();

        if (empty($_SESSION['user_id'])) {
            header("Location: /easychair/login");
            exit;
        }

        if (empty($_SESSION['conference_id'])) {
            header("Location: /easychair/select-conference");
            exit;
        }
    }

    private function go(string $target): void
    {
        $this->requireLogin();
        header("Location: {$target}");
        exit;
    }

    public function committeeImages()
    {
        $this->go('/easychair/admin/conference-home');
    }

    public function reviewerAssignments()
    {
        $this->go('/easychair/admin/submissions');
    }

    public function submissionStageRules()
    {
        $this->go('/easychair/admin/workflow');
    }

    public function testEmail()
    {
        $this->go('/easychair/admin/conference-mail');
    }

    public function conferenceRolePermissions()
    {
        $this->go('/easychair/admin/rbac-matrix');
    }

    public function conferenceBusinessPermissions()
    {
        $this->go('/easychair/admin/rbac-matrix');
    }

    public function customRights()
    {
        $this->go('/easychair/admin/rbac-matrix');
    }
}
