<?php

namespace MintyPHP\Tests\Architecture;

final class StatusTaxonomyContractFiles
{
    /**
     * @return list<string>
     */
    public static function taxonomyEnumFiles(): array
    {
        return [
            'modules/audit/lib/Module/Audit/Domain/SystemAuditOutcome.php',
            'modules/audit/lib/Module/Audit/Domain/SystemAuditChannel.php',
            'modules/audit/lib/Module/Audit/Domain/UserLifecycleAction.php',
            'modules/audit/lib/Module/Audit/Domain/UserLifecycleTriggerType.php',
            'modules/audit/lib/Module/Audit/Domain/UserLifecycleStatus.php',
            'modules/audit/lib/Module/Audit/Domain/ImportAuditStatus.php',
            'core/Domain/Taxonomy/ScheduledJobStatus.php',
            'core/Domain/Taxonomy/ScheduledJobRunStatus.php',
            'core/Domain/Taxonomy/ScheduledJobTriggerType.php',
            'core/Domain/Taxonomy/MailLogStatus.php',
            'core/Domain/Taxonomy/TenantStatus.php',
            'core/Domain/Taxonomy/SchedulerRuntimeResult.php',
        ];
    }

    /**
     * @return array<string,list<string>>
     */
    public static function taxonomySchemaExpectations(): array
    {
        return [
            'modules/audit/pages/audit/system-audit/filter-schema.php' => [
                'SystemAuditOutcome::values()',
                'SystemAuditChannel::values()',
            ],
            'modules/audit/pages/audit/settings-user-lifecycle/filter-schema.php' => [
                'gridEnumSanitizer(UserLifecycleAction::class)',
                'gridEnumSanitizer(UserLifecycleStatus::class)',
                'gridEnumSanitizer(UserLifecycleTriggerType::class)',
            ],
            'modules/audit/pages/audit/import-audit/filter-schema.php' => [
                'ImportAuditStatus::values()',
            ],
            'pages/admin/scheduled-jobs/filter-schema.php' => [
                'ScheduledJobStatus::values()',
            ],
            'pages/admin/scheduled-jobs/runs-filter-schema.php' => [
                'ScheduledJobRunStatus::values()',
                'ScheduledJobTriggerType::values()',
            ],
            'pages/admin/mail-log/filter-schema.php' => [
                'MailLogStatus::values()',
            ],
        ];
    }

    /**
     * @return list<string>
     */
    public static function taxonomyDataEndpointFiles(): array
    {
        return [
            // System audit: data + export endpoints delegate badge/label resolution
            // to SystemAuditRowPresenter, which is the enforced source of truth.
            'modules/audit/lib/Module/Audit/Service/SystemAuditRowPresenter.php',
            'modules/audit/pages/audit/settings-user-lifecycle/audit-data().php',
            'modules/audit/pages/audit/import-audit/data().php',
            'pages/admin/scheduled-jobs/data().php',
            'pages/admin/scheduled-jobs/runs-data($id).php',
            'pages/admin/mail-log/data().php',
            'pages/admin/tenants/data().php',
        ];
    }

    /**
     * @return list<string>
     */
    public static function taxonomyLiteralGuardFiles(): array
    {
        return [
            'modules/audit/lib/Module/Audit/Service/SystemAuditService.php',
            'modules/audit/lib/Module/Audit/Service/SystemAuditRowPresenter.php',
            'modules/audit/lib/Module/Audit/Repository/SystemAuditLogRepository.php',
            'modules/audit/lib/Module/Audit/Http/ApiSystemAuditReporter.php',
            'modules/audit/lib/Module/Audit/Service/UserLifecycleAuditService.php',
            'modules/audit/lib/Module/Audit/Repository/UserLifecycleAuditRepository.php',
            'modules/audit/lib/Module/Audit/Service/ImportAuditService.php',
            'modules/audit/lib/Module/Audit/Repository/ImportAuditRunRepository.php',
            'core/Service/Scheduler/SchedulerRunService.php',
            'core/Repository/Scheduler/ScheduledJobRepository.php',
            'core/Repository/Scheduler/ScheduledJobRunRepository.php',
            'core/Repository/Scheduler/SchedulerRuntimeRepository.php',
            'core/Service/Mail/MailService.php',
            'core/Repository/Mail/MailLogRepository.php',
            'core/Service/Tenant/TenantService.php',
            'core/Repository/Tenant/TenantRepository.php',
            'core/Repository/Stats/AdminStatsRepository.php',
            'modules/audit/pages/audit/system-audit/data().php',
            'modules/audit/pages/audit/settings-user-lifecycle/audit-data().php',
            'modules/audit/pages/audit/import-audit/data().php',
            'pages/admin/scheduled-jobs/data().php',
            'pages/admin/scheduled-jobs/runs-data($id).php',
            'pages/admin/mail-log/data().php',
            'pages/admin/tenants/data().php',
            'modules/audit/pages/audit/system-audit/index().php',
            'modules/audit/templates/settings-user-lifecycle-panel.phtml',
            'modules/audit/pages/audit/import-audit/index().php',
            'pages/admin/scheduled-jobs/index().php',
            'pages/admin/mail-log/index().php',
        ];
    }

    /**
     * @return list<string>
     */
    public static function forbiddenLiteralPatterns(): array
    {
        return [
            "/\\bstatus\\s*=\\s*'(running|success|partial|failed|skipped|queued|sent|active|inactive)'/",
            "/\\boutcome\\s*=\\s*'(success|failed|denied)'/",
            "/\\bchannel\\s*=\\s*'(web|api|scheduler|cli)'/",
            "/\\btrigger_type\\s*=\\s*'(scheduler|manual|cron|system)'/",
            "/\\baction\\s*=\\s*'(deactivate|delete|restore)'/",
            "/['\\\"]statuses['\\\"]\\s*=>\\s*'failed,skipped'/",
            "/['\\\"]actions['\\\"]\\s*=>\\s*'restore'/",
            "/in_array\\([^\\n]*\\[(?:[^\\]]*'(?:success|failed|denied|running|partial|skipped|queued|sent|active|inactive|scheduler|manual|web|api|cli|deactivate|delete|restore|ok|lock_not_acquired|unexpected_error)')/",
        ];
    }
}
