<?php

namespace App\Filament\Resources\SupportChannels\Schemas;

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

class SupportChannelForm
{
    public static function configure(Schema $schema): Schema
    {
        return $schema
            ->schema([
                Section::make('Channel Configuration')
                    ->schema([
                        TextInput::make('name')
                            ->placeholder('e.g. Facebook Page')
                            ->required(),
                        Select::make('category')
                            ->options([
                                'support' => 'Direct Support',
                                'social' => 'Follow Us (Social)',
                            ])
                            ->default('support')
                            ->required(),
                        Select::make('type')
                            ->options([
                                'livechat' => 'Internal Live Chat',
                                'whatsapp' => 'WhatsApp',
                                'telegram' => 'Telegram',
                                'facebook' => 'Facebook',
                                'instagram' => 'Instagram',
                                'youtube' => 'YouTube',
                                'twitter' => 'X (Twitter)',
                                'call' => 'Phone Call',
                                'email' => 'Email Address',
                            ])
                            ->required(),
                        TextInput::make('icon')
                            ->label('Icon Identifier')
                            ->placeholder('e.g. fab fa-facebook')
                            ->helperText('FontAwesome class or SVG path.'),
                    ])->columnSpan(2),

                Section::make('Link & Status')
                    ->schema([
                        TextInput::make('full_url')
                            ->label('Direct/Full URL')
                            ->placeholder('https://facebook.com/texora')
                            ->helperText('Use this for Social links.'),
                        TextInput::make('value')
                            ->placeholder('e.g. 923001234567')
                            ->helperText('Required for patterns (Support channels).'),
                        TextInput::make('url_pattern')
                            ->label('Redirect Pattern')
                            ->placeholder('https://wa.me/{val}')
                            ->helperText('Use {val} as placeholder.'),
                        TextInput::make('sort_order')
                            ->numeric()
                            ->default(0),
                        Toggle::make('is_active')
                            ->label('Is Visible?')
                            ->default(true),
                    ])->columnSpan(1),
            ])->columns(3);
    }
}
