<?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\ScalarCollectionSetting;
use AutoAdmin\Bundle\BrickBuilder\Brick\Handler\AbstractContainerBrickHandler;
use AutoAdmin\Bundle\BrickBuilder\Model\Setting;
use AutoAdmin\Bundle\Tests\Functional\Form\ItemType;

class ScalarCollectionBrickHandler extends AbstractContainerBrickHandler
{
    const BRICK_TYPE = 'brick.scalar_collection';

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

        $configurator->addSetting(
            Setting::new('items')
                ->setType(ScalarCollectionSetting::class)
                ->setFormType(CollectionType::class)
                ->setFormTypeOptions(
                    [
                        'entry_type' => ItemType::class,
                    ]
                )
        );
    }
}
