<?php

namespace Lc\SovBundle\Form\Ticket;

use App\Entity\Address;
use App\Entity\OrderShop;
use Doctrine\ORM\EntityManagerInterface;
use Lc\ShopBundle\Model\Ticket;
use Lc\ShopBundle\Services\UtilsManager;
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\EmailType;
use Symfony\Component\Form\Extension\Core\Type\FileType;
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;
use Symfony\Component\Security\Core\Security;
use Symfony\Component\Validator\Constraints\File;

class TicketMessageType extends AbstractType
{

    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
                ->add('message', TextareaType::class, [
                        'label' => 'entity.TicketMessage.fields.message',
                        'translation_domain' => 'admin',
                ])
                ->add('image', FileType::class, [
                        'label' => 'Photo',
                        'mapped' => false,
                        'required' => false,
                        'constraints' => [
                                new File([
                                                 'maxSize' => '2048k',
                                                 'mimeTypes' => [
                                                         'image/png',
                                                         'image/jpeg',
                                                         'image/jpg',
                                                         'image/gif',
                                                 ],
                                                 'mimeTypesMessage' => "Mauvais format d'image (formats acceptés : jpeg, png, gif)",
                                         ])
                        ],
                ])
                ->add('closeTicket', CheckboxType::class, [
                        'label' => 'entity.TicketMessage.fields.closeTicket',
                        'translation_domain' => 'admin',
                        'required' => false,
                ]);
    }

    public function configureOptions(OptionsResolver $resolver)
    {
        $resolver->setDefaults([
                                   // Configure your form options here
                               ]);
    }
}
