<?php

declare(strict_types=1);

namespace App\Eval\Dto;

final readonly class EvalResult
{
    /**
     * @param array<int, string> $failures
     * @param array<string, mixed> $details
     */
    public function __construct(
        public string $caseId,
        public string $type,
        public bool $passed,
        public float $durationMs,
        public array $failures = [],
        public array $details = [],
    ) {
    }

    /**
     * @return array<string, mixed>
     */
    public function toArray(): array
    {
        return [
            'case_id' => $this->caseId,
            'type' => $this->type,
            'passed' => $this->passed,
            'duration_ms' => $this->durationMs,
            'failures' => $this->failures,
            'details' => $this->details,
        ];
    }
}