<?php
namespace App\DTOs\SuperAdmin;

class SectionRuleDto
{
    public string $key;
    public string $label;
    public array $options;
    public ?string $default;

    public function __construct(array $data)
    {
        $this->key = $data['key'];
        $this->label = $data['label'];
        $this->options = $data['options'] ?? [];
        $this->default = $data['default'] ?? null;
    }

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