<?php

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

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

class CourseForm
{
    public static function configure(Schema $schema): Schema
    {
        return $schema
            ->components([
                Select::make('teacher_id')
                    ->relationship('teacher', 'name')
                    ->required(),
                TextInput::make('title')
                    ->required(),
                TextInput::make('slug')
                    ->required(),
                \Filament\Forms\Components\RichEditor::make('description')
                    ->columnSpanFull(),
                Select::make('level_id')
                    ->relationship('level', 'name'),
                TextInput::make('price')
                    ->required()
                    ->numeric()
                    ->default(0)
                    ->prefix('IDR'),
                \Filament\Forms\Components\FileUpload::make('thumbnail_url')
                    ->disk('r2')
                    ->directory('thumbnails')
                    ->visibility('public')
                    ->image()
                    ->imageEditor(),
                Toggle::make('is_published')
                    ->required(),
                Textarea::make('metadata')
                    ->columnSpanFull(),
            ]);
    }
}
