<?php

namespace App\Dto\Output;

use ApiPlatform\Metadata\ApiProperty;
use App\Entity\AbstractEntity;
use Ramsey\Uuid\UuidInterface;
use Symfony\Component\Serializer\Annotation\Groups;

abstract class AbstractOutput
{
    #[ApiProperty(identifier: true)]
    #[Groups('default')]
    public UuidInterface $uuid;

    #[ApiProperty(identifier: false)]
    #[Groups(groups: ['default', 'organizational-unit:read:collection:short'])]
    public int $id;

    public function __construct(private readonly AbstractEntity $entity)
    {
        $this->id = $entity->getId();
        $this->uuid = $entity->getUuid();
    }

    #[ApiProperty(readable: false)]
    public function getEntity(): ?AbstractEntity
    {
        return $this->entity;
    }
}