<?php

declare(strict_types=1);

namespace App\Filament\Components\Form;

use App\Filament\Support\SelectOptionLabels;

use Filament\Forms\Components\Select;
use Illuminate\Support\Facades\Auth;

class SelectedBySelect extends Select
{
    public static function create(): static
    {
        return parent::make('selected_by')
            ->label('انتخاب شده توسط')
            ->relationship('selectedBy')
            ->getOptionLabelFromRecordUsing(fn ($record) => SelectOptionLabels::user($record))
            ->searchable(['name', 'cellphone'])
            ->preload()
            ->default(Auth::id())
            ->columnSpan(6);
    }
}
