<?php
declare(strict_types=1);
namespace App\Platform\Health;

final class HealthResult
{
    public function __construct(
        public readonly string $component,
        public readonly string $label,
        public readonly HealthStatus $status,
        public readonly int $score,
        public readonly int $durationMs,
        public readonly string $message,
        public readonly array $details = [],
        public readonly int $weight = 10,
    ) {}

    public function toArray(): array
    {
        return [
            'component'=>$this->component,'label'=>$this->label,'status'=>$this->status->value,
            'status_label'=>$this->status->label(),'score'=>$this->score,'duration_ms'=>$this->durationMs,
            'message'=>$this->message,'details'=>$this->details,'weight'=>$this->weight,
        ];
    }
}
