<?php

use MintyPHP\Router;
use MintyPHP\Service\Branding\BrandingServicesFactory;
use MintyPHP\Support\Flash;
use MintyPHP\Support\Guard;
use MintyPHP\Service\Access\PermissionService;

Guard::requireLogin();
Guard::requirePermission(PermissionService::SETTINGS_UPDATE);

if (($_SERVER['REQUEST_METHOD'] ?? 'GET') !== 'POST') {
    Router::redirect('admin/settings');
    return;
}

$logoService = (new BrandingServicesFactory())->createBrandingLogoService();
$logoService->delete();
Flash::success('Logo removed', 'admin/settings', 'logo_removed');
Router::redirect('admin/settings');
