<?php
declare(strict_types=1);

namespace App\Controllers;

use App\Core\Controller;

final class SubmissionsGatewayController extends Controller
{
    public function index(): void
    {
        $orgId = (int) current_org_id();
        if (session_status() !== PHP_SESSION_ACTIVE) { @session_start(); }

        $roleId = (int)($_SESSION['user_role_id'] ?? 0);

        if (in_array($roleId, [1,2], true)) {
            redirect('admin/submissions');
        }
        if (!empty($_SESSION['user_id'])) {
            redirect('author/submissions');
        }

        redirect('login');
    }
}
