<?php

declare(strict_types=1);

use App\Support\Governance\PlatformVocabularyGlossary;
use App\Support\Tenants\TenantOperabilityReasonCode;

it('marks already archived tenant states as non-actionable while preserving diagnostics', function (): void {
    $envelope = TenantOperabilityReasonCode::TenantAlreadyArchived->toReasonResolutionEnvelope();

    expect($envelope->operatorLabel)->toBe('ManagedEnvironment already archived')
        ->and($envelope->actionability)->toBe('non_actionable')
        ->and($envelope->guidanceText())->toBe('No action needed.')
        ->and($envelope->diagnosticCode())->toBe(TenantOperabilityReasonCode::TenantAlreadyArchived->value);
});

it('translates capability denials for tenant-operability outcomes', function (): void {
    $envelope = TenantOperabilityReasonCode::MissingCapability->toReasonResolutionEnvelope();

    expect($envelope->operatorLabel)->toBe('Permission required')
        ->and($envelope->shortExplanation)->toContain('missing the capability')
        ->and(TenantOperabilityReasonCode::MissingCapability->boundaryClassification())->toBe(PlatformVocabularyGlossary::BOUNDARY_PLATFORM_CORE)
        ->and($envelope->guidanceText())->toBe('Next step: Ask a tenant Owner to grant the required capability.');
});
