<?php
namespace App\DTOs\SuperAdmin;

class ContractTemplateDto{
    public string $name;
    public ?string $description;

    /** @var array<int, array{title: string, order: int}> $sections */
    public array $sections;

    public function __construct(array $data)
    {
        $this->name = $data['name'];
        $this->description = $data['description'] ?? null;
        $this->sections = $data['sections'] ?? [];
    }

    public static function fromRequest(\Illuminate\Http\Request $request): self
    {
        return new self($request->only(['name', 'description']));
    }
}