<?php

namespace App\Filament\Resources\Goals\Schemas;

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

class GoalForm
{
    public static function configure(Schema $schema): Schema
    {
        return $schema
            ->components([
                Tabs::make('Goal Content')
                    ->tabs([
                        Tabs\Tab::make('Content')
                            ->icon('heroicon-o-flag')
                            ->schema([
                                Section::make('Goal Information')
                                    ->schema([
                                        Forms\Components\TextInput::make('title')
                                            ->label('Title')
                                            ->required()
                                            ->maxLength(255)
                                            ->prefixIcon('heroicon-o-document-text')
                                            ->placeholder('Enter goal title')
                                            ->columnSpanFull(),
                                        
                                        Forms\Components\Textarea::make('summary')
                                            ->label('Summary')
                                            ->rows(4)
                                            ->maxLength(1000)
                                            ->placeholder('Enter goal summary')
                                            ->helperText('Brief description of the goal')
                                            ->columnSpanFull(),
                                        
                                        Forms\Components\TextInput::make('icon')
                                            ->label('Icon')
                                            ->maxLength(255)
                                            ->prefixIcon('heroicon-o-sparkles')
                                            ->placeholder('e.g., heroicon-o-flag, fa-star, etc.')
                                            ->helperText('Icon class name or identifier')
                                            ->columnSpanFull(),
                                    ])
                                    ->columns(1),
                            ]),
                        
                        Tabs\Tab::make('Settings')
                            ->icon('heroicon-o-cog-6-tooth')
                            ->schema([
                                Section::make('Display Settings')
                                    ->schema([
                                        Forms\Components\Toggle::make('is_active')
                                            ->label('Active')
                                            ->helperText('Show this goal on the website')
                                            ->default(true),
                                        
                                        Forms\Components\TextInput::make('order')
                                            ->label('Display Order')
                                            ->numeric()
                                            ->default(0)
                                            ->helperText('Lower numbers appear first')
                                            ->minValue(0),
                                    ])
                                    ->columns(2),
                            ]),
                    ])
                    ->columnSpanFull(),
            ]);
    }
}
