<?php

namespace App\Controllers;

require_once BASE_PATH . '/app/helpers/permissions.php';

use App\Core\Controller;
use App\Services\Governance\GovernanceSummaryService;

/*
|--------------------------------------------------------------------------
| Enterprise Governance Suite
| Admin Governance Controller
| Pack 2500-C Step 5
|--------------------------------------------------------------------------
*/

class AdminGovernanceController extends Controller
{
    public function index()
    {
        if (session_status() !== PHP_SESSION_ACTIVE) {
            session_start();
        }

        if (empty($_SESSION['user_id'])) {

            header("Location: /easychair/login");

            exit;

        }

        $governance =
            GovernanceSummaryService::dashboard();

        $this->render(

            'admin/governance/dashboard',

            [

                'governance' => $governance,

                'pageTitle'  => 'Enterprise Governance'

            ]

        );
    }
}
