<?php

namespace App\Filament\SuperAdmin\Pages\Auth;

use Filament\Auth\Pages\EditProfile as BaseEditProfile;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Components\Select;
use Filament\Schemas\Schema;
use Illuminate\Support\Facades\Log;

class EditProfile extends BaseEditProfile
{
    public function mount(): void
    {
        Log::info('EditProfile class loaded for superadmin');
        parent::mount();
    }

    public function form(Schema $schema): Schema
    {
        return $schema
            ->schema([
                $this->getNameFormComponent(),
                $this->getEmailFormComponent(),
                TextInput::make('username')
                    ->required()
                    ->unique(ignoreRecord: true)
                    ->maxLength(255),
                Select::make('preferred_locale')
                    ->options([
                        'de' => 'Deutsch',
                        'en' => 'English',
                    ])
                    ->default('de')
                    ->required(),
                $this->getPasswordFormComponent(),
                $this->getPasswordConfirmationFormComponent(),
                $this->getCurrentPasswordFormComponent(),
            ]);
    }
}