<?php

declare(strict_types=1);

namespace App\Controllers;

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

/**
 * Gallery Controller
 *
 * Handles the public gallery page display.
 */
class GalleryController extends Controller
{
    /**
     * Display the gallery page.
     *
     * @return void
     */
    public function index(): void
    {
        $galleryModel = $this->model('Gallery');
        $settingModel = $this->model('Setting');

        $galleryItems = $galleryModel->getActive();
        $categories   = $galleryModel->getCategories();
        $settings     = $settingModel->getAll();
        $csrfToken    = generateCsrfToken();

        $this->view('gallery/index', [
            'title'       => 'Photo Gallery - Gmind Institute',
            'currentPage' => 'gallery',
            'galleryItems' => $galleryItems,
            'categories'  => $categories,
            'settings'    => $settings,
            'csrfToken'   => $csrfToken,
        ]);
    }
}
