<?php

declare(strict_types=1);

namespace App\Support\Providers\Capabilities;

final readonly class ProviderCapabilityDefinition
{
    /**
     * @param  array<int, string>  $operationTypes
     * @param  array<int, string>  $providerRequirementKeys
     */
    public function __construct(
        public string $key,
        public string $label,
        public array $operationTypes,
        public array $providerRequirementKeys,
        public string $defaultReasonCode,
    ) {}

    /**
     * @return array{
     *     key: string,
     *     label: string,
     *     operation_types: array<int, string>,
     *     provider_requirement_keys: array<int, string>,
     *     default_reason_code: string
     * }
     */
    public function toArray(): array
    {
        return [
            'key' => $this->key,
            'label' => $this->label,
            'operation_types' => $this->operationTypes,
            'provider_requirement_keys' => $this->providerRequirementKeys,
            'default_reason_code' => $this->defaultReasonCode,
        ];
    }
}
