<?php

namespace AutoAdmin\Bundle\Tests\Functional\BrickBuilder\Brick\Handler;

use AutoAdmin\Bundle\Admin\Form\Type\Component\CollectionType;
use AutoAdmin\Bundle\BrickBuilder\Brick\Config\Configurator;
use AutoAdmin\Bundle\BrickBuilder\Brick\ConfigSetting\EntityCollectionSetting;
use AutoAdmin\Bundle\BrickBuilder\Brick\Handler\AbstractContainerBrickHandler;
use AutoAdmin\Bundle\BrickBuilder\Model\Setting;
use AutoAdmin\Bundle\Tests\Functional\Form\EntityType;

class EntityCollectionBrickHandler extends AbstractContainerBrickHandler
{
    const BRICK_TYPE = 'brick.entity_collection';

    public function configure(Configurator $configurator)
    {
        parent::configure($configurator);

        $configurator->addSetting(
            Setting::new('entities')
                ->setType(EntityCollectionSetting::class)
                ->setFormType(CollectionType::class)
                ->setFormTypeOptions(
                    [
                        'entry_type' => EntityType::class,
                    ]
                )
        );
    }
}
