<?php

namespace App\Filament\Resources\Abouts\Schemas;

use Filament\Forms\Components\FileUpload;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Components\Textarea;
use Filament\Forms\Components\RichEditor;
use Filament\Forms\Components\Toggle;
use Filament\Forms\Components\Hidden;
use Filament\Schemas\Schema;

class AboutForm
{
    public static function configure(Schema $schema): Schema
    {
        return $schema
            ->components([
                TextInput::make('title')
                    ->label('Judul') 
                    ->required()
                    ->unique(ignoreRecord: true),
                FileUpload::make('image')
                    ->label('Gambar') 
                    ->directory('about')
                    ->disk('public')
                    ->image()
                    ->maxSize(2048) 
                    ->columnSpanFull()
                    ->helperText('Rekomendasi: Format JPG/PNG, Max 2MB.'),


                RichEditor::make('content')
                    ->label('Konten') 
                    ->default(null)
                    ->columnSpanFull(),
                Toggle::make('is_active')
                    ->label('Status Aktif') 
                    ->required(),
                Hidden::make('created_by')
                    ->default(fn () => auth()->id()),
                Hidden::make('updated_by')
                    ->default(fn () => auth()->id()),
            ]);
    }
}