<?php

namespace App\Form;

use App\Entity\Investigation;
use App\Entity\Question;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;

use Symfony\Component\Form\Extension\Core\Type\ChoiceType;

class QuestionType extends AbstractType
{
    public function buildForm(FormBuilderInterface $builder, array $options): void
    {
        $builder
            ->add('title')
            ->add('name_en', null, [
                'label' => '🇬🇧 Name',
            ])
            ->add('name_fr', null, [
                'label' => '🇫🇷 Nom',
            ])
            ->add('name_ar', null, [
                'label' => '🇸🇦 العربية',
            ])
            ->add('choice', ChoiceType::class, [
                'label' => 'Gender',
                'choices' => [
                    'Choix Multiple' => 'multiple',
                    'Choix Unique' => 'unique',
                ],
                'expanded' => true, // This makes it radio buttons instead of select
                'multiple' => false, // Single selection
                'required' => true,
                'placeholder' => false, // Remove the empty option
            ])
            ->add('type_modality', ChoiceType::class, [
                'label' => 'Type',
                'choices' => [
                    'text' => '0',
                    'image' => '1',
                    'video' => '2',
                    'son' => '3',
                    'input text' => '4',
                ],
                'placeholder' => 'Choose a type modality', // Optional placeholder
                'required' => true,
            ])
            ->add('amount')
            ->add('max_participant')
        ;
    }

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