<?php

declare(strict_types=1);

namespace App\Filament\Components\Form;

use Filament\Forms\Components\Repeater;

class AttributeValueRepeater extends Repeater
{
    public static function create(): static
    {
        return parent::make('values')
            ->relationship()
            ->label('مقادیر ویژگی')
            ->schema([
                TitleTextInput::create(),
                DescTextarea::create(),
                HexColorPicker::create(),
                CreateByHidden::create(),
            ])
            ->columns(2)
            ->collapsed()
            ->itemLabel(function (array $state): ?string {
                return $state['title'] ?? null;
            })
            ->columnSpan(12);
    }
}
