<?php

namespace App\Form\Frontend;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\OptionsResolver\OptionsResolver;

use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\Extension\Core\Type\IntegerType;

use App\Entity\User;

class UserAdresseType extends AbstractType
{
    public function buildForm(FormBuilderInterface $builder, array $options): void
    {
        $builder
            ->add('country', TextType::class, array(
                'label' => 'Pays',
                'required' => true
            ))
            ->add('zip', IntegerType::class, array(
                'label' => 'Code Postal',
                'required' => true
            ))
            ->add('adresse', TextType::class, array(
                'label' => 'Adresse',
                'required' => true
            ))
            ->add("save", SubmitType::class, ['attr'=>['class'=>'save'] ])
        ;
    }

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