<?php

namespace App\Form;

use App\Entity\Usrlog;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;

class UsrlogType extends AbstractType
{
    public function buildForm(FormBuilderInterface $builder, array $options): void
    {
        $builder
            ->add('pcode')
            ->add('agent', TextareaType::class)
            ->add('clientIp', null, [
                'label' => 'IP клиента',
            ])
            ->add('method', ChoiceType::class, [
                'choices' => [
                    'Вход в систему' => 'вход в систему',
                    'Выход' => 'выход',
                ],
            ])
        ;
    }

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