<?php

namespace App\Filament\Resources\TrainingFeedbacks\Schemas;

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

class TrainingFeedbackForm
{
    public static function configure(Schema $schema): Schema
    {
        return $schema
            ->components([
                Section::make('General Info')
                    ->columns(2)
                    ->schema([
                        TextInput::make('name')
                            ->nullable(),
                        TextInput::make('email')
                            ->email()
                            ->nullable(),
                        TextInput::make('organization')
                            ->nullable(),
                        TextInput::make('event_name')
                            ->label('Event / session name')
                            ->nullable(),
                        TextInput::make('training_date')
                            ->type('date')
                            ->nullable(),
                        TextInput::make('facilitator')
                            ->nullable(),
                        TextInput::make('audience_segment')
                            ->nullable(),
                    ]),

                Section::make('Satisfaction Ratings')
                    ->columns(3)
                    ->schema([
                        Select::make('content_satisfaction')
                            ->options([
                                1 => '1 - Very dissatisfied',
                                2 => '2 - Dissatisfied',
                                3 => '3 - Neutral',
                                4 => '4 - Satisfied',
                                5 => '5 - Very satisfied',
                            ])
                            ->required(),
                        Select::make('trainer_expertise')
                            ->options([
                                1 => '1 - Very dissatisfied',
                                2 => '2 - Dissatisfied',
                                3 => '3 - Neutral',
                                4 => '4 - Satisfied',
                                5 => '5 - Very satisfied',
                            ])
                            ->required(),
                        Select::make('overall_experience')
                            ->options([
                                5 => '5 - Excellent',
                                4 => '4 - Good',
                                3 => '3 - Neutral',
                                2 => '2 - Poor',
                                1 => '1 - Very poor',
                            ])
                            ->required(),
                    ]),

                Section::make('Trainer & Session Evaluations')
                    ->columns(2)
                    ->schema([
                        Select::make('scheduling_rating')
                            ->label('Scheduling / Timing Rating')
                            ->options([
                                1 => '1 - Bad',
                                2 => '2',
                                3 => '3',
                                4 => '4',
                                5 => '5 - Excellent',
                            ])
                            ->required(),
                        Select::make('trainer_personalization')
                            ->label('Trainer Personalization Scale')
                            ->options([
                                1 => '1 - Not at all',
                                2 => '2',
                                3 => '3',
                                4 => '4',
                                5 => '5 - Extremely well',
                            ])
                            ->required(),
                        Textarea::make('scheduling_comment')
                            ->label('Scheduling comment')
                            ->columnSpanFull(),
                        Textarea::make('trainer_advice')
                            ->label('Clear and actionable advice feedback')
                            ->columnSpanFull(),
                    ]),

                Section::make('Mindset & Recommendations')
                    ->schema([
                        Textarea::make('financial_mindset_impact')
                            ->label('Mindset impact')
                            ->columnSpanFull(),
                        Textarea::make('recommend_training')
                            ->label('Recommendation notes')
                            ->columnSpanFull(),
                        CheckboxList::make('greatest_impact_topics')
                            ->options([
                                'Money Personality & Values Clarification' => 'Money Personality & Values Clarification',
                                'Budgeting Basics (budget sheet, tracking expenses etc)' => 'Budgeting Basics (budget sheet, tracking expenses etc)',
                                'Managing Debt' => 'Managing Debt',
                                'Investing and Investment Options' => 'Investing and Investment Options',
                            ]),
                        CheckboxList::make('more_time_topics')
                            ->options([
                                'Money Personality & Values Clarification' => 'Money Personality & Values Clarification',
                                'Budgeting Basics (budget sheet, tracking expenses etc)' => 'Budgeting Basics (budget sheet, tracking expenses etc)',
                                'Managing Debt' => 'Managing Debt',
                                'Investing and Investment Options' => 'Investing and Investment Options',
                            ]),
                    ]),

                Section::make('Improvements & Additional Feedback')
                    ->schema([
                        Textarea::make('recommended_improvements')
                            ->label('Improvements or additional services')
                            ->columnSpanFull(),
                        Textarea::make('trainer_additional_feedback')
                            ->label('Additional trainer feedback')
                            ->columnSpanFull(),
                    ]),
            ]);
    }
}
