<?php

namespace App\Filament\Pages\Analytic\Schemas;

use App\Enums\RoleEnum;
use Filament\Forms\Components\DatePicker;
use Filament\Schemas\Components\Fieldset;
use Filament\Schemas\Schema;

class AnalyticFiltersForm
{
    public static function configure(Schema $schema): Schema
    {
        return $schema
            ->schema([
                Fieldset::make('Filter')
                    ->schema([
                        DatePicker::make('startDate')
                            ->label('Tanggal Mulai')
                            ->placeholder('Pilih tanggal mulai')
                            ->native(false)
                            ->displayFormat('l, d F Y'),

                        DatePicker::make('endDate')
                            ->label('Tanggal Selesai')
                            ->placeholder('Pilih tanggal selesai')
                            ->native(false)
                            ->displayFormat('l, d F Y'),
                    ])
                    ->columns(2)
                    ->columnSpanFull()
                    ->visible(fn () => auth()->user()?->hasRole(RoleEnum::DEVELOPER->value) || auth()->user()?->hasRole(RoleEnum::ADMINISTRATOR->value)),
            ]);
    }
}
