<?php

declare(strict_types=1);

namespace App\Support\Artifacts;

use Illuminate\Contracts\Support\Arrayable;
use JsonSerializable;

/**
 * @implements Arrayable<string, mixed>
 */
final readonly class ArtifactProviderDetail implements Arrayable, JsonSerializable
{
    public function __construct(
        public ?string $legacyFindingType = null,
        public ?string $legacyReportType = null,
        public ?string $legacyPolicyType = null,
        public ?string $providerObjectType = null,
        public ?string $providerDisplayType = null,
        public ?string $detectorDetail = null,
    ) {}

    /**
     * @return array{
     *     legacy_finding_type: ?string,
     *     legacy_report_type: ?string,
     *     legacy_policy_type: ?string,
     *     provider_object_type: ?string,
     *     provider_display_type: ?string,
     *     detector_detail: ?string
     * }
     */
    public function toArray(): array
    {
        return [
            'legacy_finding_type' => $this->legacyFindingType,
            'legacy_report_type' => $this->legacyReportType,
            'legacy_policy_type' => $this->legacyPolicyType,
            'provider_object_type' => $this->providerObjectType,
            'provider_display_type' => $this->providerDisplayType,
            'detector_detail' => $this->detectorDetail,
        ];
    }

    /**
     * @return array<string, mixed>
     */
    public function jsonSerialize(): array
    {
        return $this->toArray();
    }
}
