<?php

namespace App\Dto\Output;

use ApiPlatform\Metadata\ApiProperty;
use ApiPlatform\Metadata\Get;
use App\Entity\Client;
use App\Entity\OrganizationalUnit;
use App\Entity\Subnet;
use Symfony\Component\Serializer\Annotation\Groups;

#[Get(shortName: 'Subnet')]
final class SubnetOutput extends AbstractOutput
{
    #[Groups(['subnet:read'])]
    public string $name;

    #[Groups(['subnet:read'])]
    public string $netmask;

    #[Groups(['subnet:read'])]
    public string $ipAddress;

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

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

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

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

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

    #[Groups(['subnet:read'])]
    public ?int $serverId;

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

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

    public function __construct(Subnet $subnet)
    {
        parent::__construct($subnet);

        $this->name = $subnet->getName();
        $this->netmask = $subnet->getNetmask();
        $this->ipAddress = $subnet->getIpAddress();
        $this->nextServer = $subnet->getNextServer();
        $this->router = $subnet->getRouter();
        $this->dns = $subnet->getDns();
        $this->bootFileName = $subnet->getBootFileName();
        $this->synchronized = $subnet->isSynchronized();
        $this->serverId = $subnet->getServerId();
        $this->createdAt = $subnet->getCreatedAt();
        $this->createdBy = $subnet->getCreatedBy();
    }
}