<?php

namespace App\Form;

use App\Entity\Genre;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;

class GenreType extends AbstractType
{
    public function buildForm(FormBuilderInterface $builder, array $options): void
    {
        $builder
            ->add('genre', null, [
                'label' => 'Genre',
                'label_attr' => ['class' => 'label'],
                'attr' => ['class' => 'input'],
                'row_attr' => ['class' => 'field'],
                'help_attr' => ['class' => 'help'],

                'required' => true,
                ])
            ->add('slug', null, [
                'label' => 'Slug',
                'label_attr' => ['class' => 'label'],
                'attr' => ['class' => 'input'],
                'row_attr' => ['class' => 'field'],
                'help_attr' => ['class' => 'help'],

                'help' => 'Laissez vide pour le générer automatiquement',
                'required' => false,
            ])
        ;
    }

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