<?php

namespace App\Filament\Resources\Users\Schemas;

use Filament\Schemas\Schema;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Components\Select;
use Filament\Schemas\Components\Section;

class UserForm
{
    public static function configure(Schema $schema): Schema
    {
        return $schema
            ->schema([
                Section::make('Basic Information')
                    ->columns(2)
                    ->schema([
                        TextInput::make('name')
                            ->required()
                            ->maxLength(255),
                        TextInput::make('email')
                            ->email()
                            ->required()
                            ->unique(ignoreRecord: true)
                            ->maxLength(255),
                        TextInput::make('phone')
                            ->tel()
                            ->maxLength(255),
                        Select::make('role')
                            ->options([
                                'admin' => 'Administrator',
                                'user' => 'Customer',
                            ])
                            ->required()
                            ->default('user'),
                    ]),
                Section::make('Business Details')
                    ->columns(2)
                    ->schema([
                        TextInput::make('business_name')
                            ->maxLength(255),
                        TextInput::make('ntn_number')
                            ->label('NTN')
                            ->maxLength(255),
                        TextInput::make('strn_number')
                            ->label('STRN')
                            ->maxLength(255),
                        TextInput::make('cnic')
                            ->label('CNIC')
                            ->maxLength(255),
                    ]),
                Section::make('Location')
                    ->schema([
                        TextInput::make('city')
                            ->maxLength(255),
                        TextInput::make('address')
                            ->maxLength(255),
                    ]),
            ]);
    }
}
