<?php

namespace AppBundle\Form;

use Doctrine\Common\Collections\Collection;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\CollectionType;
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\FormEvent;
use Symfony\Component\Form\FormEvents;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Validator\Constraints\Choice;
use Symfony\Component\Validator\Constraints\NotNull;
use AppBundle\Entity\FewoSeason;


class FewoLodgingType extends AbstractType
{

    /**
     * {@inheritdoc}
     */
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
            ->add('name', null, [
                'required' => true,
            ])
            ->add('description', null, [
                'required' => true,
            ])
            ->add('equipment', null, [
                'required' => true,
            ])
            ->add('adress1', null, [
                'required' => true,
            ])
            ->add('adress2')
            ->add('zipCode', null, [
                'required' => true,
            ])
            ->add('city', null, [
                'required' => true,
            ])
            ->add('maximumPersons', TextType::class, [
                'required' => true,
            ])
            ->add('deposit', null, [
                'required' => true,
            ])
            //->add('calendarVisible')
            ->add('group', EntityType::class, [
                'placeholder' => '(Bitte wählen) *',
                'class' => 'AppBundle\Entity\FewoLodgingGroup',
                'constraints' => [
                    new NotNull()
                ]
            ])
             ->add('type', EntityType::class, [
                'placeholder' => '(Bitte wählen) *',
                'class' => 'AppBundle\Entity\FewoLodgingType',
                'constraints' => [
                    new NotNull()
                ]
            ])

        ;
    }
    
    /**
     * {@inheritdoc}
     */
    public function configureOptions(OptionsResolver $resolver)
    {
        $resolver->setDefaults(array(
            'data_class' => 'AppBundle\Entity\FewoLodging'
        ));

    }

    /**
     * {@inheritdoc}
     */
    public function getBlockPrefix()
    {
        return 'appbundle_fewolodging';
    }


}
