<?php

declare(strict_types=1);

namespace App\Support\Ui\GovernanceActions;

use App\Support\Ui\GovernanceActions\Enums\GovernanceFrictionClass;
use App\Support\Ui\GovernanceActions\Enums\GovernanceReasonPolicy;

final readonly class GovernanceActionRule
{
    /**
     * @param  array<int, string>  $surfaceKeys
     */
    public function __construct(
        public string $actionKey,
        public string $familyKey,
        public GovernanceFrictionClass $frictionClass,
        public GovernanceReasonPolicy $reasonPolicy,
        public string $dangerPolicy,
        public string $canonicalLabel,
        public string $modalHeading,
        public string $modalDescription,
        public string $successTitle,
        public string $auditVerb,
        public string $serviceOwner,
        public array $surfaceKeys = [],
    ) {}

    public function requiresConfirmation(): bool
    {
        return $this->frictionClass->requiresConfirmation();
    }

    public function requiresReason(): bool
    {
        return $this->reasonPolicy->requiresReason();
    }

    public function requiresDangerSeparation(): bool
    {
        return $this->dangerPolicy === 'required';
    }
}
