<?php

use MintyPHP\Buffer;
use MintyPHP\Http\SessionStoreInterface;
use MintyPHP\Service\Access\SettingsAuthorizationPolicy;
use MintyPHP\Support\Guard;

$session = app(SessionStoreInterface::class)->all();
Guard::requireLogin();

$currentUserId = (int) ($session['user']['id'] ?? 0);
$authorizationService = app(\MintyPHP\Service\Access\AuthorizationService::class);
$viewDecision = $authorizationService->authorize(SettingsAuthorizationPolicy::ABILITY_ADMIN_SETTINGS_VIEW, [
    'actor_user_id' => $currentUserId,
]);
if (!$viewDecision->isAllowed()) {
    Guard::deny();
}

Buffer::set('title', t('Settings'));

$breadcrumbs = [
    ['label' => t('Home'), 'path' => 'admin'],
    ['label' => t('Settings')],
];
