<?php
require_once __DIR__ . '/../../config/constants.php';
require_once __DIR__ . '/../../config/database.php';
require_once __DIR__ . '/../../app/Database.php';
require_once __DIR__ . '/../../app/Auth.php';
require_once __DIR__ . '/../../app/Helper.php';
require_once __DIR__ . '/../../app/Subscription.php';

$database     = new Database($pdo);
$auth         = new Auth($database);
$subscription = new Subscription($database);

if (!$auth->isLoggedIn()) {
    Helper::redirect(APP_URL . '/auth/login.php');
}

if ($_SESSION['role'] !== 'admin') {
    Helper::redirect(APP_URL . '/dashboard.php');
}
