<?php

namespace App\Dto\Output;

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

#[Get(shortName: 'ImageRepository')]
class ImageRepositoryOutput extends AbstractOutput
{
    #[Groups(['repository:read', 'image:read', 'client:read', "organizational-unit:read", "image-image-repository:read"])]
    public ?string $name = '';

    #[Groups(['repository:read'])]
    public ?string $ip = '';

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

    #[Groups(['repository:read'])]
    public ?string $sshPort = '';

    #[Groups(['repository:read'])]
    public ?string $user = '';

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

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

    public function __construct(ImageRepository $imageRepository, bool $status = true)
    {
        parent::__construct($imageRepository);

        $this->name = $imageRepository->getName();
        $this->ip = $imageRepository->getIp();
        $this->comments = $imageRepository->getComments();
        $this->sshPort = $imageRepository->getSshPort();
        $this->user = $imageRepository->getUser();
        $this->createdAt = $imageRepository->getCreatedAt();
        $this->createdBy = $imageRepository->getCreatedBy();
    }

}