<?php

namespace App\Form;

use App\Entity\Jail;
use App\Form\DocumentType;
use App\Form\Type\ContentType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;

class JailType extends DocumentType
{
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        parent::buildForm($builder, $options);

        $builder
            ->add('arrestedAt', null, ['label' => 'form_label_arrested_at', 'help' => 'form_help_arrested_at'])
            ->add('jailedAt', null, ['label' => 'form_label_jailed_at', 'help' => 'form_help_jailed_at'])
            ->add('lawyer', CheckboxType::class, ['label' => 'form_label_asked_for_lawyer', 'required' => false])
            ->add('medic', CheckboxType::class, ['label' => 'form_label_asked_for_medic', 'required' => false])
            ->add('content', ContentType::class)
        ;
    }

    public function configureOptions(OptionsResolver $resolver)
    {
        $resolver->setDefaults([
            'data_class' => Jail::class,
        ]);
    }
}
