<?php


namespace AutoAdmin\Bundle\Media\Form\Type\Media;


use AutoAdmin\Bundle\Admin\Form\Type\Component\CollectionType;
use AutoAdmin\Bundle\Media\Attributes\LinkedMedia;
use Doctrine\DBAL\Types\Types;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;

/**
 * #[ORM\Column(type: Types::JSON)]
 * #[LinkedMedia(mappings: ['image','file'])]
 * protected ?array $linkedMediaCollection = [];
 */
class LinkedMediaCollectionType extends AbstractType
{
    public function configureOptions(OptionsResolver $resolver)
    {
        parent::configureOptions($resolver);

        $resolver->setDefaults([
            'entry_type'=> LinkedMediaType::class,
            'entry_options'=> [],
        ]);
    }

    public function getParent(): string
    {
        return CollectionType::class;
    }

    public function getBlockPrefix(): string
    {
        return 'aa_media_collection';
    }

    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        parent::buildForm($builder, $options);
    }


}
