<?php

namespace App\DTO;

use App\Enum\TaskStatus;
use Symfony\Component\Serializer\Attribute\Context;
use Symfony\Component\Serializer\Normalizer\DateTimeNormalizer;
use Symfony\Component\Validator\Constraints as Assert;

class TaskRequest
{
    public function __construct(
        #[Assert\NotBlank]
        #[Assert\Length(max: 255)]
        public readonly string $name,

        #[Context([DateTimeNormalizer::FORMAT_KEY => '!Y-m-d'])]
        public readonly ?\DateTimeImmutable $date = null,

        #[Assert\NotNull]
        public readonly TaskStatus $status = TaskStatus::Active,
    ) {
    }
}
