<?php

declare(strict_types=1);

namespace PpPhp\Core\Designer\Definitions;

/**
 * ComponentDefinition
 *
 * Describes one Designer component available in the Components panel.
 * This is a lightweight definition object only; it does not render or create runtime output.
 */
final class ComponentDefinition
{
    public function __construct(
        private readonly string $type,
        private readonly string $label,
        private readonly string $category = 'General',
        private readonly string $icon = 'grip-vertical',
        private readonly string $description = '',
        private readonly array $defaults = [],
        private readonly array $classes = []
    ) {
    }

    public function type(): string { return $this->type; }
    public function label(): string { return $this->label; }
    public function category(): string { return $this->category; }
    public function icon(): string { return $this->icon; }
    public function description(): string { return $this->description; }
    public function defaults(): array { return $this->defaults; }
    public function classes(): array { return $this->classes; }

    public function toArray(): array
    {
        return [
            'type' => $this->type,
            'label' => $this->label,
            'category' => $this->category,
            'icon' => $this->icon,
            'description' => $this->description,
            'defaults' => $this->defaults,
            'classes' => $this->classes,
        ];
    }
}
