<?php

namespace App\Dto\Output;

use ApiPlatform\Metadata\Get;
use App\Entity\View;
use Symfony\Component\Serializer\Annotation\Groups;

#[Get(shortName: 'View')]
final class ViewOutput extends AbstractOutput
{
    #[Groups(['view:read'])]
    public string $name;

    #[Groups(['view:read'])]
    public bool $favorite;

    #[Groups(['view:read'])]
    public ?array $filters = null;

    public function __construct(View $view)
    {
        parent::__construct($view);

        $this->name = $view->getName();
        $this->favorite = $view->isFavourite();
        $this->filters = $view->getFilters();
    }
}