<?php

namespace App\Filament\Resources\Testimonials\Schemas;

use Filament\Forms;
use Filament\Schemas\Components\Section;
use Filament\Schemas\Components\Tabs;
use Filament\Schemas\Schema;

class TestimonialForm
{
    public static function configure(Schema $schema): Schema
    {
        return $schema
            ->components([
                Tabs::make('Testimonial Content')
                    ->tabs([
                        Tabs\Tab::make('Content')
                            ->icon('heroicon-o-chat-bubble-left-right')
                            ->schema([
                                Section::make('Client Information')
                                    ->schema([
                                        Forms\Components\TextInput::make('client_name')
                                            ->label('Client Name')
                                            ->required()
                                            ->maxLength(255)
                                            ->prefixIcon('heroicon-o-user')
                                            ->placeholder('Enter client name')
                                            ->columnSpanFull(),
                                        
                                        Forms\Components\TextInput::make('client_position')
                                            ->label('Position/Title')
                                            ->maxLength(255)
                                            ->prefixIcon('heroicon-o-briefcase')
                                            ->placeholder('e.g., CEO, Manager')
                                            ->columnSpan(1),
                                        
                                        Forms\Components\TextInput::make('client_company')
                                            ->label('Company Name')
                                            ->maxLength(255)
                                            ->prefixIcon('heroicon-o-building-office')
                                            ->placeholder('Enter company name')
                                            ->columnSpan(1),
                                        
                                        Forms\Components\Textarea::make('testimonial')
                                            ->label('Testimonial')
                                            ->required()
                                            ->rows(5)
                                            ->maxLength(1000)
                                            ->placeholder('Enter client testimonial')
                                            ->helperText('The review or feedback from the client')
                                            ->columnSpanFull(),
                                    ])
                                    ->columns(2),
                                
                                Section::make('Client Photo')
                                    ->schema([
                                        Forms\Components\FileUpload::make('client_image')
                                            ->label('Client Photo')
                                            ->image()
                                            ->imageEditor()
                                            ->disk('public')
                                            ->directory('testimonials')
                                            ->maxSize(2048)
                                            ->helperText('Recommended size: 200x200 pixels (square)')
                                            ->imagePreviewHeight('150')
                                            ->columnSpanFull(),
                                    ])
                                    ->columns(1)
                                    ->collapsible(),
                            ]),
                        
                        Tabs\Tab::make('Settings')
                            ->icon('heroicon-o-cog-6-tooth')
                            ->schema([
                                Section::make('Display Settings')
                                    ->schema([
                                        Forms\Components\Select::make('rating')
                                            ->label('Rating')
                                            ->options([
                                                5 => '5 Stars',
                                                4 => '4 Stars',
                                                3 => '3 Stars',
                                                2 => '2 Stars',
                                                1 => '1 Star',
                                            ])
                                            ->default(5)
                                            ->required()
                                            ->helperText('Star rating from the client'),
                                        
                                        Forms\Components\Toggle::make('is_active')
                                            ->label('Active')
                                            ->helperText('Show this testimonial on the website')
                                            ->default(true),
                                        
                                        Forms\Components\TextInput::make('order')
                                            ->label('Display Order')
                                            ->numeric()
                                            ->default(0)
                                            ->helperText('Lower numbers appear first')
                                            ->minValue(0),
                                    ])
                                    ->columns(3),
                            ]),
                    ])
                    ->columnSpanFull(),
            ]);
    }
}
