<?php

namespace App\Filament\Admin\Resources\Settings\Schemas;

use Filament\Forms\Components\RichEditor;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Components\Toggle;
use Filament\Schemas\Components\Grid;
use Filament\Schemas\Components\Section;
use Filament\Schemas\Schema;

class SettingForm
{
    public static function configure(Schema $schema): Schema
    {
        return $schema
            ->components([

                Grid::make()->schema([

                    /*
                    |----------------------------------------------------------------------
                    | Feature Toggles
                    |----------------------------------------------------------------------
                    */
                    Section::make('Feature Toggles')
                        ->description('Enable or disable main system modules.')
                        ->schema([
                            Toggle::make('package_active')->label('Packages Active')->required(),
                            Toggle::make('product_active')->label('Products Active')->required(),
                            Toggle::make('top_up_active')->label('Top Up Active')->required(),
                            Toggle::make('blog_active')->label('Blog Active')->required(),
                        ])
                        ->columns(4)
                        ->columnSpanFull(),


                    /*
                    |----------------------------------------------------------------------
                    | Basic Info
                    |----------------------------------------------------------------------
                    */
                    Section::make('Basic Info')
                        ->description('General website information.')
                        ->schema([

                            TextInput::make('currency')
                                ->label('Currency')
                                ->required()
                                ->default('USD'),

                            TextInput::make('phone')
                                ->label('Phone Number')
                                ->tel(),

                            TextInput::make('sys_email')
                                ->label('System Email')
                                ->email()
                                ->required(),

                        ])
                        ->columns(2)
                        ->columnSpanFull(),


                    /*
                    |----------------------------------------------------------------------
                    | English Website Information
                    |----------------------------------------------------------------------
                    */
                    Section::make('English Website Info')
                        ->description('Enter the English content of your website.')
                        ->schema([

                            TextInput::make('en_website_name')
                                ->label('Website Name (English)')
                                ->columnSpanFull(),

                            RichEditor::make('en_address')
                                ->label('Address (English)')
                                ->columnSpanFull(),

                            RichEditor::make('en_working_hours')
                                ->label('Working Hours (English)')
                                ->columnSpanFull(),

                        ])
                        ->columnSpanFull(),


                    /*
                    |----------------------------------------------------------------------
                    | Persian Website Information (RTL)
                    |----------------------------------------------------------------------
                    */
                    Section::make('اطلاعات وبسایت (فارسی)')
                        ->description('معلومات مربوط به زبان فارسی.')
                        ->extraAttributes(['dir' => 'rtl', 'class' => 'text-right'])
                        ->schema([

                            TextInput::make('fa_website_name')
                                ->label('نام وبسایت (فارسی)')
                                ->columnSpanFull(),

                            RichEditor::make('fa_address')
                                ->label('آدرس (فارسی)')
                                ->columnSpanFull(),

                            RichEditor::make('fa_working_hours')
                                ->label('ساعات کاری (فارسی)')
                                ->columnSpanFull(),

                        ])
                        ->columnSpanFull(),


                    /*
                    |----------------------------------------------------------------------
                    | Social Media Links
                    |----------------------------------------------------------------------
                    */
                    Section::make('Social Media Links')
                        ->description('Add social media accounts.')
                        ->schema([

                            TextInput::make('whatsapp_link')
                                ->label('WhatsApp')
                                ->placeholder('https://wa.me/123456789')
                                ->url(),

                            TextInput::make('facebook_link')
                                ->label('Facebook')
                                ->placeholder('https://facebook.com/yourpage')
                                ->url(),

                            TextInput::make('instagram_link')
                                ->label('Instagram')
                                ->placeholder('https://instagram.com/yourprofile')
                                ->url(),

                            TextInput::make('twitter_link')
                                ->label('Twitter / X')
                                ->placeholder('https://twitter.com/yourprofile')
                                ->url(),

                            TextInput::make('linkedin_link')
                                ->label('LinkedIn')
                                ->placeholder('https://linkedin.com/in/yourprofile')
                                ->url(),

                            TextInput::make('youtube_link')
                                ->label('YouTube')
                                ->placeholder('https://youtube.com/@yourchannel')
                                ->url(),

                            TextInput::make('tiktok_link')
                                ->label('TikTok')
                                ->placeholder('https://tiktok.com/@yourprofile')
                                ->url(),

                        ])
                        ->columns(2)
                        ->columnSpanFull(),



                    /*
                    |----------------------------------------------------------------------
                    | Map Section
                    |----------------------------------------------------------------------
                    */
                    Section::make('Map')
                        ->description('Google Map embed frame.')
                        ->schema([
                            RichEditor::make('map_embed_link')
                                ->label('Map Embed Code')
                                ->columnSpanFull(),
                        ])
                        ->columnSpanFull(),

                ])->columnSpanFull(),
            ]);
    }
}
