<?php

namespace App\Api\Model;

use App\Document\Chart;

class ChartOutput
{
    public function __construct(
        public ?string $id,
        public ?string $name,
        public ?array $metadata,
        public ?array $table,
    ) {
    }

    public static function fromEntity(Chart $entity): self
    {
        return new self(
            $entity->getId(),
            $entity->getName(),
            $entity->getMetadata(),
            $entity->getTable(),
        );
    }
}
