<?php

declare(strict_types=1);

namespace App\Support\Ui\DerivedState;

enum DerivedStateFamily: string
{
    case ArtifactTruth = 'artifact_truth';
    case OperationUxGuidance = 'operation_ux_guidance';
    case OperationUxExplanation = 'operation_ux_explanation';
    case RelatedNavigationPrimary = 'related_navigation_primary';
    case RelatedNavigationDetail = 'related_navigation_detail';
    case RelatedNavigationHeader = 'related_navigation_header';
    case TenantGovernanceAggregate = 'tenant_governance_aggregate';

    public function allowsNegativeResultCache(): bool
    {
        return match ($this) {
            self::TenantGovernanceAggregate => false,
            default => true,
        };
    }

    public function defaultFreshnessPolicy(): string
    {
        return RequestScopedDerivedStateStore::FRESHNESS_INVALIDATE_AFTER_MUTATION;
    }
}
