<?php

namespace App\Form;

use App\Entity\User;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\PasswordType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\Extension\Core\Type\EmailType;
class UserChangePasswordType extends AbstractType
{
    public function __construct(private EntityManagerInterface $manager) {
        
    }

    public function buildForm(FormBuilderInterface $builder, array $options): void
    {
        $builder
            ->add('old_password', PasswordType::class, [ 'required' => true, 'attr' => ['maxlength' => 150],
            'translation_domain' => 'admin' ])
            ->add('new_password', PasswordType::class, [ 'required' => true, 'attr' => ['maxlength' => 150],
            'translation_domain' => 'admin' ])
            ->add('confirm_new_password', PasswordType::class, [ 'required' => true, 'attr' => ['maxlength' => 150],
            'translation_domain' => 'admin' ])
        ;
    }

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