<?php

namespace App\Filament\Admin\Resources\Users\Schemas;

use Filament\Forms\Components\CheckboxList;
use Filament\Forms\Components\DateTimePicker;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\TextInput;
use Filament\Schemas\Components\Grid;
use Filament\Schemas\Components\Section;
use Filament\Schemas\Schema;

class UserForm
{
    public static function configure(Schema $schema): Schema
    {
        return $schema
            ->components([
                Grid::make()->schema([

                    /*
                |--------------------------------------------------------------------------
                | User Information
                |--------------------------------------------------------------------------
                */
                    Section::make('User Information')
                        ->description('Enter the basic information for the user.')
                        ->extraAttributes([
                            'style' => 'background-color:#ffffff;padding:15px;border-radius:8px;border:1px solid #e5e7eb;box-shadow:0 1px 3px rgba(0,0,0,0.05);'
                        ])
                        ->schema([
                            TextInput::make('name')
                                ->label('Full Name')
                                ->required(),

                            TextInput::make('email')
                                ->label('Email Address')
                                ->email()
                                ->required(),

                            DateTimePicker::make('email_verified_at')
                                ->label('Email Verified At'),

                            TextInput::make('password')
                                ->label('Password')
                                ->password()
                                ->required(),
                        ])
                        ->columns(2)
                        ->columnSpanFull(),

                ])->columnSpanFull(),

                // Using Select Component
                Section::make('Roles')
                    ->description('Assign roles to the user.')
                    ->extraAttributes([
                        'style' => 'background-color:#ffffff;padding:15px;border-radius:8px;border:1px solid #e5e7eb;box-shadow:0 1px 3px rgba(0,0,0,0.05);'
                    ])
                    ->schema([
             

                        CheckboxList::make('roles')
                            ->relationship('roles', 'name')
                            ->searchable(),
                    ])
                    ->columns(2)
                    ->columnSpanFull(),

            ]);
    }
}
