<?php

use MintyPHP\Buffer;
use MintyPHP\Router;
use MintyPHP\Support\Flash;
use MintyPHP\Support\Guard;

Guard::requireLogin();
Guard::requireAbility(\MintyPHP\Service\Access\OperationsAuthorizationPolicy::ABILITY_ADMIN_IMPORTS_AUDIT_VIEW);

$runId = (int) ($id ?? 0);
$auditRun = $runId > 0 ? app(\MintyPHP\Service\Audit\ImportAuditService::class)->find($runId) : null;
if (!$auditRun) {
    Flash::error(t('Import audit entry not found'), 'admin/import-audit', 'import_audit_not_found');
    Router::redirect('admin/import-audit');
}

Buffer::set('title', t('View import audit entry'));
