<?php

declare(strict_types=1);

namespace App\Controllers;

use App\Core\Controller;
use App\Models\Topper;
use App\Models\Setting;

/**
 * Topper Controller
 *
 * Handles the public toppers page display.
 */
class TopperController extends Controller
{
    /**
     * Display the toppers page.
     *
     * @return void
     */
    public function index(): void
    {
        $topperModel  = $this->model('Topper');
        $settingModel = $this->model('Setting');

        $toppers  = $topperModel->getActive(50);
        $settings = $settingModel->getAll();
        $csrfToken = generateCsrfToken();

        $this->view('toppers/index', [
            'title'       => 'Our Star Performers - Gmind Institute',
            'currentPage' => 'toppers',
            'toppers'     => $toppers,
            'settings'    => $settings,
            'csrfToken'   => $csrfToken,
        ]);
    }
}
