37 lines
1.0 KiB
PHP
37 lines
1.0 KiB
PHP
<?php
|
|
|
|
namespace App\DTO;
|
|
|
|
use App\Enum\TaskSchemaStatus;
|
|
use App\Enum\TaskStatus;
|
|
use Symfony\Component\Serializer\Attribute\Context;
|
|
use Symfony\Component\Serializer\Normalizer\DateTimeNormalizer;
|
|
use Symfony\Component\Validator\Constraints as Assert;
|
|
|
|
class TaskSchemaRequest
|
|
{
|
|
public function __construct(
|
|
#[Assert\NotBlank]
|
|
#[Assert\Length(max: 255)]
|
|
public readonly string $name,
|
|
|
|
#[Assert\NotNull]
|
|
public readonly TaskSchemaStatus $status = TaskSchemaStatus::Active,
|
|
|
|
#[Assert\NotNull]
|
|
public readonly TaskStatus $taskStatus = TaskStatus::Active,
|
|
|
|
#[Context([DateTimeNormalizer::FORMAT_KEY => '!Y-m-d'])]
|
|
public readonly ?\DateTimeImmutable $date = null,
|
|
|
|
public readonly ?array $repeat = null,
|
|
|
|
#[Context([DateTimeNormalizer::FORMAT_KEY => '!Y-m-d'])]
|
|
public readonly ?\DateTimeImmutable $start = null,
|
|
|
|
#[Context([DateTimeNormalizer::FORMAT_KEY => '!Y-m-d'])]
|
|
public readonly ?\DateTimeImmutable $end = null,
|
|
) {
|
|
}
|
|
}
|