<?php

namespace RxConnexionBundle\Form;

use Doctrine\Common\Persistence\ObjectManager;
use RxConnexionBundle\Entity\PatientChartIsDoneEntity;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\OptionsResolver\OptionsResolver;
use RxConnexionBundle\Form\DataTransformer\DataTransformer;

class PatientChartIsDoneForm extends AbstractType
{
    private $manager;

    public function __construct(ObjectManager $manager) {
    }

    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
            ->add('id', TextType::class, array(
                'label' => 'Encounter ID',
                'attr' => array(
                    'readonly' => 'true'
                )
            ))
            ->add('note', TextareaType::class, array(
                'label' => 'Note',
                'mapped' => false,
                'required' => false
            ))
            ->add('is_done', ChoiceType::class, array(
                'label' => 'Status',
                'label_attr' => array(
                    'class' => ''
                ),
                'mapped' => false,
                'required' => true,
                'choices' => PatientChartIsDoneEntity::IS_DONE,
            ));
    }

    public function getBlockPrefix()
    {
        return 'patient_chart_is_done';
    }

    public function configureOptions(OptionsResolver $resolver)
    {
        $resolver->setDefaults(array(
            'data_class' 	  => 'RxConnexionBundle\Entity\PatientChartEntity',
            'csrf_protection' => true,
            'csrf_field_name' => '_token',
            // a unique key to help generate the secret token
            'intention'       => 'patient_chart_is_done_intention'
        ));
    }
}