<?php

namespace App\Filament\Resources\Activities\Schemas;

use Filament\Forms\Components\DatePicker;
use Filament\Forms\Components\DateTimePicker;
use Filament\Forms\Components\Textarea;
use Filament\Forms\Components\TextInput;
use Filament\Schemas\Schema;

class ActivityForm
{
    public static function configure(Schema $schema): Schema
    {
        return $schema->components([
            TextInput::make('title')->label('Judul')->required(),
            Textarea::make('description')->label('Deskripsi')->rows(3)->columnSpanFull(),
            DatePicker::make('start_date')->label('Mulai')->required(),
            DatePicker::make('end_date')->label('Selesai')->required(),
            DateTimePicker::make('executed_at')->label('Waktu Pelaksanaan')
                ->visible(fn ($record) => $record?->status === 'approved'),
            Textarea::make('execution_notes')->label('Catatan Pelaksanaan')->rows(3)->columnSpanFull()
                ->visible(fn ($record) => $record?->status === 'approved'),
        ]);
    }
}
