<?php

namespace App\Dto\Input;

use ApiPlatform\Metadata\ApiProperty;
use App\Dto\Output\ClientOutput;
use App\Validator\Constraints\ClientsHaveSamePartitionSize;
use App\Validator\Constraints\OrganizationalUnitMulticastMode;
use App\Validator\Constraints\OrganizationalUnitMulticastPort;
use App\Validator\Constraints\OrganizationalUnitP2PMode;
use Symfony\Component\Serializer\Annotation\Groups;

#[ClientsHaveSamePartitionSize]
class DeployImageInput
{
    #[Groups(['image-image-repository:write'])]
    #[ApiProperty(description: 'The type of the image deployment', example: "")]
    public ?string $type = 'monolithic';

    #[Groups(['image-image-repository:write'])]
    #[ApiProperty(description: 'The deployment method', example: "unicast")]
    public ?string $method = null;

    /**
     * @var ClientOutput[]
     */
    #[Groups(['image-image-repository:write'])]
    #[ApiProperty(description: 'The clients to deploy the image to')]
    public ?array $clients = [];

    #[Groups(['image-image-repository:write'])]
    #[ApiProperty(description: 'The disk number to deploy to', example: 1)]
    public ?int $diskNumber = null;

    #[Groups(['image-image-repository:write'])]
    #[ApiProperty(description: 'The partition number to deploy to', example: 1)]
    public ?int $partitionNumber = null;

    #[OrganizationalUnitP2PMode]
    #[Groups(['image-image-repository:write'])]
    #[ApiProperty(description: 'P2P mode for torrent deployment', example: "seed")]
    public ?string $p2pMode = null;

    #[Groups(['image-image-repository:write'])]
    #[ApiProperty(description: 'P2P time for torrent deployment', example: 3600)]
    public ?int $p2pTime = 0;

    #[Groups(['image-image-repository:write'])]
    #[ApiProperty(description: 'Multicast IP address', example: "239.255.255.250")]
    public ?string $mcastIp = null;

    #[Groups(['image-image-repository:write'])]
    #[ApiProperty(description: 'Multicast speed in Mbps', example: 100)]
    public ?int $mcastSpeed = null;

    #[OrganizationalUnitMulticastPort]
    #[Groups(['image-image-repository:write'])]
    #[ApiProperty(description: 'Multicast port', example: 8000)]
    public ?int $mcastPort = null;

    #[OrganizationalUnitMulticastMode]
    #[Groups(['image-image-repository:write'])]
    #[ApiProperty(description: 'Multicast mode', example: "full")]
    public ?string $mcastMode = null;

    #[Groups(['image-image-repository:write'])]
    #[ApiProperty(description: 'Maximum number of clients for multicast', example: 50)]
    public ?int $maxClients = null;

    #[Groups(['image-image-repository:write'])]
    #[ApiProperty(description: 'Maximum time for deployment in seconds', example: 3600)]
    public ?int $maxTime = null;

    #[Groups(['image-image-repository:write'])]
    #[ApiProperty(description: 'Whether to queue the deployment', example: false)]
    public bool $queue = false;
}    
