<?php

namespace App\Domains\{{domain}}\{{model}}\DTOs;

use App\Core\Interfaces\DTOInterface;

readonly final class {{model}}DTO implements DTOInterface
{
    public function __construct(
        public ?int    $id = null,
        public ?string $name = null,
        public ?string $created_at = null,
        public ?string $updated_at = null,
    ) {}

    public static function fromRequest(array $data): self
    {
        return new self(
            id: $data['id'] ?? null,
            name: $data['name'] ?? null,
            created_at: $data['created_at'] ?? null,
            updated_at: $data['updated_at'] ?? null,
        );
    }
}