<?php

namespace App\Form;

use App\Entity\ProductBlocked;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\DateTimeType;
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;

class ProductBlockedType extends AbstractType
{
    public function buildForm(FormBuilderInterface $builder, array $options): void
    {
        $builder
            ->add('dateStart', DateTimeType::class, [
                'widget' => 'single_text',
                'label' => 'Début du blocage',
                'input' => 'datetime_immutable',
            ])
            ->add('dateEnd', DateTimeType::class, [
                'widget' => 'single_text',
                'label' => 'Fin du blocage',
                'input' => 'datetime_immutable',
            ])
            ->add('reason', TextareaType::class, [
                'label' => 'Raison (optionnel)',
                'required' => false,
            ])
        ;
    }

    public function configureOptions(OptionsResolver $resolver): void
    {
        $resolver->setDefaults([
            'data_class' => ProductBlocked::class,
        ]);
    }
}
