<?php

namespace App\Filament\Pages;

use App\Settings\GeneralSettings as Settings;
use Filament\Forms\Components\FileUpload;
use Filament\Forms\Components\Textarea;
use Filament\Forms\Components\TextInput;
use Filament\Pages\SettingsPage;
use Filament\Schemas\Components\Section;
use Filament\Schemas\Schema;

class GeneralSettings extends SettingsPage
{
    protected static ?string $navigationLabel = 'Umumy Sazlamalar';

    protected static ?string $title = 'Umumy Sazlamalar';

    protected static string|\BackedEnum|null $navigationIcon = 'heroicon-o-cog-6-tooth';

    protected static string $settings = Settings::class;

    public function form(Schema $schema): Schema
    {
        return $schema
            ->components([
                Section::make('Umumy')->schema([
                    TextInput::make('site_title')
                        ->label('Saýdyň ady')
                        ->required(),
                    TextInput::make('marquee_text')
                        ->label('Hereketli tekst')
                        ->required(),
                ]),

                Section::make('Biz barada')->schema([
                    TextInput::make('about_label')
                        ->label('Biz barada kiçi tekst')
                        ->required(),
                    TextInput::make('about_title')
                        ->label('Biz barada sözbaşy')
                        ->required(),
                    Textarea::make('about_text')
                        ->label('Biz barada tekst')
                        ->required(),
                    FileUpload::make('about_image')
                        ->label('Biz barada surat')
                        ->image()
                        ->visibility('public')
                        ->directory('settings'),
                ]),

                Section::make('Sosial torlar we Bizi tapyň')->schema([
                    TextInput::make('find_us_label')
                        ->label('Bizi tapyň ýarlyk')
                        ->required(),
                    TextInput::make('instagram_url')
                        ->label('Instagram URL')
                        ->url()
                        ->required(),
                    TextInput::make('tiktok_url')
                        ->label('TikTok URL')
                        ->url()
                        ->required(),
                ]),

                Section::make('Podwal')->schema([
                    Textarea::make('footer_address')
                        ->label('Podwal salgysy')
                        ->required(),
                    TextInput::make('footer_phone')
                        ->label('Podwal telefony')
                        ->required(),
                    TextInput::make('footer_copyright')
                        ->label('Podwal awtorlyk hukugy')
                        ->required(),
                ]),
            ]);
    }
}
