<?php

namespace Lc\ShopBundle\Form\Backend\Ticket;

use App\Entity\Product;
use Doctrine\ORM\EntityManagerInterface;
use Lc\ShopBundle\Context\CreditHistoryInterface;
use Lc\ShopBundle\Context\OrderProductInterface;
use Lc\ShopBundle\Context\OrderReductionCartInterface;
use Lc\ShopBundle\Context\OrderShopInterface;
use Lc\ShopBundle\Context\OrderUtilsInterface;
use Lc\ShopBundle\Context\ProductInterface;
use Lc\ShopBundle\Context\ReductionCartInterface;
use Lc\ShopBundle\Context\ReductionCreditInterface;
use Lc\ShopBundle\Context\TicketInterface;
use Lc\ShopBundle\Context\TicketMessageInterface;
use Lc\ShopBundle\Form\DataTransformer\ProductToIdTransformer;
use Lc\ShopBundle\Model\CreditHistory;
use Lc\ShopBundle\Model\Ticket;
use Lc\ShopBundle\Services\Utils;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\ButtonType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\DateType;
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
use Symfony\Component\Form\Extension\Core\Type\MoneyType;
use Symfony\Component\Form\Extension\Core\Type\NumberType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;

class TicketStatusType extends AbstractType
{
        protected $em;


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

        public function buildForm(FormBuilderInterface $builder, array $options)
        {
                $builder->add('status', ChoiceType::class, array(
                        'choices'=>array(
                                'field.Ticket.statusOptions.'.Ticket::TICKET_STATUS_OPEN => Ticket::TICKET_STATUS_OPEN,
                                'field.Ticket.statusOptions.'.Ticket::TICKET_STATUS_BEING_PROCESSED => Ticket::TICKET_STATUS_BEING_PROCESSED,
                                'field.Ticket.statusOptions.'.Ticket::TICKET_STATUS_CLOSED => Ticket::TICKET_STATUS_CLOSED,
                        ),
                        'required'=>true,
                        'expanded'=>true
                        ));

        }

        public function configureOptions(OptionsResolver $resolver)
        {
                $resolver->setDefaults([
                        'data_class' => $this->em->getClassMetadata(TicketInterface::class)->getName(),
                        'translation_domain' => 'lcshop'
                ]);
        }
}
