<?php

declare(strict_types=1);

namespace App\Support;

final readonly class CanonicalOperationType
{
    public function __construct(
        public string $canonicalCode,
        public ?string $domainKey,
        public ?string $artifactFamily,
        public string $displayLabel,
        public bool $supportsOperatorExplanation = false,
        public ?int $expectedDurationSeconds = null,
    ) {}

    /**
     * @return array{
     *     canonical_code: string,
     *     domain_key: ?string,
     *     artifact_family: ?string,
     *     display_label: string,
     *     supports_operator_explanation: bool,
     *     expected_duration_seconds: ?int
     * }
     */
    public function toArray(): array
    {
        return [
            'canonical_code' => $this->canonicalCode,
            'domain_key' => $this->domainKey,
            'artifact_family' => $this->artifactFamily,
            'display_label' => $this->displayLabel,
            'supports_operator_explanation' => $this->supportsOperatorExplanation,
            'expected_duration_seconds' => $this->expectedDurationSeconds,
        ];
    }
}