<?php

namespace App\Form;

use App\Entity\CaseDocument;
use App\Entity\CompanyDocument;
use App\Entity\Member;
use App\Entity\User;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\EnumType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;

class CaseDocumentFormType extends AbstractType
{
    public function buildForm(FormBuilderInterface $builder, array $options): void
    {
        $docs = $options['docs'];
        $builder
            ->add('document', EntityType::class, [
                'class' => CompanyDocument::class,
                'choices' => $docs,
                'multiple' => true,
                'expanded' => true,
                'choice_label' => 'title',
            ])
        ;
    }

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