<?php
declare(strict_types=1);

namespace PpPhp\Core\Designer\Property;

final class DesignerPropertyEditor
{
    public function __construct(
        private readonly string $type,
        private readonly string $label,
        private readonly string $component = 'input',
        private readonly array $settings = []
    ) {}

    public static function create(string $type, string $label, string $component = 'input', array $settings = []): self
    {
        return new self($type, $label, $component, $settings);
    }

    public function type(): string { return $this->type; }

    public function toArray(): array
    {
        return [
            'type' => $this->type,
            'label' => $this->label,
            'component' => $this->component,
            'settings' => $this->settings,
        ];
    }
}
