<?php

namespace Lc\ShopBundle\Form\Backend\Common;

use Lc\ShopBundle\Context\GroupUserInterface;
use Lc\ShopBundle\Form\Backend\ReductionCommon\BehaviorTaxRateType;
use Lc\ShopBundle\Form\Backend\ReductionCommon\DateEndType;
use Lc\ShopBundle\Form\Backend\ReductionCommon\DateStartType;
use Lc\ShopBundle\Form\Backend\ReductionCommon\GroupUsersFilterType;
use Lc\ShopBundle\Form\Backend\ReductionCommon\PermanentType;
use Lc\ShopBundle\Form\Backend\ReductionCommon\UnitType;
use Lc\ShopBundle\Form\Backend\ReductionCommon\UsersFilterType;
use Lc\ShopBundle\Form\Backend\ReductionCommon\ValueType;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\DateTimeType;
use Symfony\Component\Form\Extension\Core\Type\NumberType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;


class ReductionCatalogType extends AbstractType
{
        protected $em;

        public function __construct(EntityManagerInterface $entityManager)
        {
                $this->em = $entityManager;
        }

        public function buildForm(FormBuilderInterface $builder, array $options)
        {
                $builder
                        ->add('title', TextType::class, [
                                'label' => 'Titre',
                                'required' => false,
                        ])
                        ->add('behaviorTaxRate', BehaviorTaxRateType::class)
                        ->add('unit', UnitType::class)
                        ->add('value', ValueType::class)
                        ->add('permanent', PermanentType::class)
                        ->add('dateStart', DateStartType::class)
                        ->add('dateEnd', DateEndType::class)
                        ->add('users', UsersFilterType::class)
                        ->add('groupUsers', GroupUsersFilterType::class);
        }

        public function configureOptions(OptionsResolver $resolver)
        {
                $resolver->setDefaults([
                        'label' => false,
                        'translation_domain'=> 'lcshop'
                ]);
        }
}
