<?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 SenderSelect extends Select
{
    public static function create(): static
    {
        return parent::make('sender_id')
            ->label('فرستنده')
            ->relationship('sender', 'name')
            ->getOptionLabelFromRecordUsing(fn ($record) => SelectOptionLabels::user($record))
            ->searchable(['name', 'cellphone'])
            ->preload()
            ->default(Auth::id())
            ->columnSpan(6);
    }
}
