<?php

namespace App\Filament\Resources\Leads\Schemas;

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

class LeadForm
{
    public static function configure(Schema $schema): Schema
    {
        return $schema
            ->schema([
                Section::make('Lead Credentials')
                    ->schema([
                        TextInput::make('name')
                            ->placeholder('Full Name (if provided)'),
                        TextInput::make('email_phone')
                            ->label('Email / WhatsApp')
                            ->required(),
                        TextInput::make('service_interest')
                            ->label('Service Interest')
                            ->placeholder('Selected service from chat'),
                        Select::make('status')
                            ->options([
                                'new' => 'New Lead',
                                'contacted' => 'Contacted',
                                'converted' => 'Converted',
                                'junk' => 'Junk',
                            ])
                            ->default('new')
                            ->required(),
                    ])->columnSpan(2),

                Section::make('Source Information')
                    ->schema([
                        TextInput::make('source_url')
                            ->disabled()
                            ->label('Captured at URL'),
                        Select::make('offer_id')
                            ->relationship('offer', 'title')
                            ->label('Associated Offer')
                            ->disabled(),
                    ])->columnSpan(1),
            ])->columns(3);
    }
}
