<?php

namespace App\Dto\Output;

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

#[Get(shortName: 'Menu')]
final class MenuOutput extends AbstractOutput
{
    #[Groups(['menu:read', 'organizational-unit:read'])]
    public string $name;

    #[Groups(['menu:read'])]
    public string $resolution;

    #[Groups(['menu:read'])]
    public ?string $comments = null;

    #[Groups(['menu:read'])]
    public ?string $publicUrl = null;

    #[Groups(['menu:read'])]
    public ?string $privateUrl = null;

    #[Groups(['menu:read'])]
    public ?bool $isDefault = false;

    #[Groups(['menu:read'])]
    public \DateTime $createdAt;

    #[Groups(['menu:read'])]
    public ?string $createdBy = null;

    public function __construct(Menu $menu)
    {
        parent::__construct($menu);

        $this->name = $menu->getName();
        $this->resolution = $menu->getResolution();
        $this->comments = $menu->getComments();
        $this->publicUrl = $menu->getPublicUrl();
        $this->privateUrl = $menu->getPrivateUrl();
        $this->isDefault = $menu->isDefault();
        $this->createdAt = $menu->getCreatedAt();
        $this->createdBy = $menu->getCreatedBy();
    }
}