<?php

namespace App\Api\Model;

use App\Document\Chart;
use Symfony\Component\Validator\Constraints as Assert;

class ChartInput
{
    public function __construct(
        //public ?string $id = "",
         #[Assert\Type('string')]
         #[Assert\NotBlank()]
        public string $name,

        public array $metadata,
        public array $table,
    ) {
    }

    public function toEntity(): Chart
    {
        $chart = new Chart();
        $chart->setName($this->name);
        $chart->setMetadata($this->metadata);
        $chart->setTable($this->table);

        return $chart;
    }
}
