<?php
declare(strict_types=1);

namespace PpPhp\Core\Designer\Acceptance;

final class DesignerAcceptanceScenario
{
    public function __construct(
        private readonly string $id,
        private readonly string $label,
        private readonly array $checks = []
    ) {}

    public static function create(string $id, string $label, array $checks = []): self
    {
        return new self($id, $label, $checks);
    }

    public function id(): string { return $this->id; }
    public function label(): string { return $this->label; }
    public function checks(): array { return $this->checks; }
    public function ok(): bool
    {
        foreach ($this->checks as $check) {
            if (!($check['ok'] ?? false)) return false;
        }
        return true;
    }

    public function toArray(): array
    {
        return ['id'=>$this->id,'label'=>$this->label,'ok'=>$this->ok(),'checks'=>$this->checks];
    }
}
