<?php

declare(strict_types=1);

namespace App\Filament\Components\Form;

use App\Models\Variant;
use Filament\Forms\Components\Repeater;

class VariantsRepeater extends Repeater
{
    public static function create(): static
    {
        return parent::make('variants')
            ->label('تنوع‌ها')
            ->relationship()
            ->schema([
                DisplayNameTextInput::create(),
                PriceTextInput::create(),
                QuantityTextInput::create(),
                SellerSelect::create(),
                StatusSelect::create(Variant::class),
                CreateByHidden::create(),
                ProductHidden::create(),
            ])
            ->columns(5)
            ->collapsed()
            ->itemLabel(fn (array $state): ?string => $state['display_name'] ?? null)
            ->columnSpan(12);
    }
}
