<?php

namespace Lc\SovBundle\Form\Ticket;

use Lc\SovBundle\Doctrine\EntityManager;
use Lc\SovBundle\Model\Ticket\TicketMessageInterface;
use Lc\SovBundle\Translation\TranslatorAdmin;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;

class TicketMessageAdminFormType extends AbstractType
{
    protected $em;
    protected $translatorAdmin;

    public function __construct(EntityManager $em, TranslatorAdmin $translatorAdmin)
    {
        $this->em = $em;
        $this->translatorAdmin = $translatorAdmin;
    }

    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder->add(
            'message',
            TextareaType::class,
            [
                'required' => true
            ]
        );
        $builder->add(
                'answerByAdmin',
            HiddenType::class,
                [
                        'data' => 1
                ]
        );
    }

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