<?php

namespace App\Form;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use App\Core\Form\FileManager\FilePickerType;
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
use Symfony\Component\Validator\Constraints\NotBlank;
use Symfony\Component\Form\Extension\Core\Type\TextType;

class StlFileType extends AbstractType
{
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder->add('position', HiddenType::class);

        $builder->add(
            'name',
            TextType::class,
            [
                'label' => 'Nom',
                'required' => true,
                'attr' => [
                ],
                'row_attr' => [
                    'class' => 'col-md-6',
                ],
                'constraints' => [
                    new NotBlank(),
                ],
            ]
        );

        $builder->add(
            'file',
            FilePickerType::class,
            [
                'label' => 'Fichier STL',
                'required' => true,
                'row_attr' => [
                    'class' => 'col-md-6',
                ],
                'constraints' => [
                ],
            ]
        );

        $builder->add(
            'htmlPreviewFile',
            FilePickerType::class,
            [
                'label' => 'Rendu HTML',
                'required' => false,
                'row_attr' => [
                    'class' => 'col-md-6',
                ],
                'constraints' => [
                ],
            ]
        );
    }

    public function configureOptions(OptionsResolver $resolver)
    {
        $resolver->setDefaults([
            // Configure your form options here
        ]);
    }
}
