<?php

namespace App\Dto\Output;

use ApiPlatform\Metadata\ApiProperty;
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', 'client:read', 'organizational-unit:read'])]
    #[ApiProperty(
        description: 'El nombre del menú de arranque',
        example: 'Menú Principal'
    )]
    public string $name;

    #[Groups(['menu:read', 'client:read', 'organizational-unit:read'])]
    #[ApiProperty(
        description: 'La resolución del menú',
        example: '1024x768'
    )]
    public string $resolution;

    #[Groups(['menu:read'])]
    #[ApiProperty(
        description: 'Comentarios sobre el menú',
        example: 'Menú de arranque predeterminado para todas las aulas'
    )]
    public ?string $comments = null;

    #[Groups(['menu:read'])]
    #[ApiProperty(
        description: 'URL pública del menú',
        example: 'https://example.com/menu/public'
    )]
    public ?string $publicUrl = null;

    #[Groups(['menu:read'])]
    #[ApiProperty(
        description: 'URL privada del menú',
        example: 'https://example.com/menu/private'
    )]
    public ?string $privateUrl = null;

    #[Groups(['menu:read'])]
    #[ApiProperty(
        description: 'Indica si es el menú predeterminado',
        example: true
    )]
    public ?bool $isDefault = false;

    #[Groups(['menu:read'])]
    #[ApiProperty(
        description: 'Fecha de creación del menú',
        example: '2024-01-15T10:30:00+00:00'
    )]
    public \DateTime $createdAt;

    #[Groups(['menu:read'])]
    #[ApiProperty(
        description: 'Usuario que creó este registro',
        example: 'admin'
    )]
    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();
    }
}