<?php

namespace App\Filament\Resources\Vacations\Schemas;

use App\Enums\VacationType;
use App\Filament\Support\HrForm;
use Filament\Forms\Components\DatePicker;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\Textarea;
use Filament\Schemas\Schema;

class VacationForm
{
    public static function configure(Schema $schema): Schema
    {
        return $schema
            ->components([
                HrForm::employeeSelect(),
                Select::make('type')
                    ->label(__('hr.fields.type'))
                    ->options(VacationType::class)
                    ->required()
                    ->native(false),
                HrForm::leaveDatePicker('start_date', __('hr.fields.start_date'))
                    ->native(false),
                HrForm::leaveDatePicker('end_date', __('hr.fields.end_date'))
                    ->native(false),
                DatePicker::make('return_date')
                    ->label(__('hr.fields.return_date'))
                    ->native(false),
                HrForm::leaveDaysDisplay(),
                Textarea::make('reason')
                    ->label(__('hr.fields.reason'))
                    ->rows(3)
                    ->columnSpanFull(),
                HrForm::fileUpload('attachment_path')
                    ->label(__('hr.fields.attachment'))
                    ->acceptedFileTypes(['application/pdf', 'image/*'])
                    ->maxSize(10240),
            ]);
    }
}
