<?php

namespace App\Form;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
use Symfony\Component\Form\Extension\Core\Type\EmailType;
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Validator\Constraints as Assert;

class ContactType extends AbstractType
{
    public function buildForm(FormBuilderInterface $builder, array $options): void
    {
        $builder
            ->add('lastName', TextType::class, [
                'constraints' => [new Assert\NotBlank()],
            ])
            ->add('firstName', TextType::class, [
                'constraints' => [new Assert\NotBlank()],
            ])
            ->add('company', TextType::class, [
                'required' => false,
            ])
            ->add('email', EmailType::class, [
                'constraints' => [
                    new Assert\NotBlank(),
                    new Assert\Email(),
                ],
            ])
            ->add('phoneNumber', TextType::class, [
                'required' => true,
            ])
            ->add('mobilePhoneNumber', TextType::class, [
                'required' => false,
            ])
            ->add('message', TextareaType::class, [
                'constraints' => [new Assert\NotBlank()],
            ])
            ->add('agreeToPolicies', CheckboxType::class, [
                'constraints' => [new Assert\IsTrue()],
            ])
        ;
    }
}
