<?php

/*
 * This file is part of the VitiCore 2.
 *
 * (c) CP Creation <web@cpcreation.fr>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace CpCreation\VitiCore\Bridge\Symfony\Bundle\Form\Admin;

use A2lix\TranslationFormBundle\Form\Type\TranslationsType;
use CpCreation\VitiCore\Shop\Model\ShopConfigDisableCountry;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\CountryType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;

final class ShopConfigDisableCountryType extends AbstractType
{
    public function buildForm(FormBuilderInterface $builder, array $options): void
    {
        $builder
            ->add('country', CountryType::class, [
                'label' => 'Choisir un pays',
                'required' => true,
            ])
            ->add(
                'translations', TranslationsType::class, [
                    'label' => false,
                    'required' => false,
                    'fields' => [
                        'description' => [
                            'field_type' => TrumbowygType::class,
                            'label' => 'Texte à afficher lorsque la boutique est bloqué pour ce pays',
                            'help' => 'Si aucun texte, le texte par défaut sera utilisé',
                            'required' => false,
                        ],
                    ],
                ]
            );
    }

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