<?php

namespace App\Form;

use App\Entity\TypeEvent;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;

class TypeEventType extends AbstractType
{
    public function buildForm(FormBuilderInterface $builder, array $options): void
    {
        $builder
        ->add('name', TextType::class, [ 
            'required' => true, 'attr' => ['maxlength' => 150],
            'translation_domain' => 'admin' 
        ])
        ->add('onHomePage', CheckboxType::class, [ 
            'required' => false ,
            'translation_domain' => 'admin' 
        ])
        ->add('onSpectaclePage', CheckboxType::class, [ 
            'required' => false ,
            'translation_domain' => 'admin' 
        ])
        ->add('onOtherEventPage', CheckboxType::class, [ 
            'required' => false ,
            'translation_domain' => 'admin' 
        ])
        ->add('active', CheckboxType::class, [ 
            'required' => false ,
            'translation_domain' => 'admin' 
        ])
        ;
    }

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