<?php

namespace LivraisonParSecteurs\Form;

use LivraisonParSecteurs\LivraisonParSecteurs;
use Thelia\Form\BaseForm;
use Symfony\Component\Validator\Constraints;

/**
 * Class ScheduleCreateForm
 * @package LivraisonParSecteurs\Form
 */
class ScheduleCreateForm extends BaseForm
{
    /**
     * @inheritDoc
     */
    protected function buildForm()
    {
        $this->formBuilder
            ->add(
                "area_id","integer", [
                "label_attr" => ["for" => "attr-area-id"],
                "required" => true,
                "constraints" => [new Constraints\NotBlank()]
            ])
            ->add("day", "choice", [
                "choices" => LivraisonParSecteurs::getDayLabel(null),
                "label" => $this->translator->trans("Delivery day", [], LivraisonParSecteurs::MESSAGE_DOMAIN),
                "label_attr" => ["for" => "attr-area-schedule-day"],
                "required" => true,
                "multiple" => false,
                "constraints" => [new Constraints\NotBlank()],
                "attr" => array()
            ])
            ->add("begin_time", "time", [
                "label" => $this->translator->trans("Delivery beginning time", [], LivraisonParSecteurs::MESSAGE_DOMAIN),
                "label_attr" => ["for" => "attr-area-schedule-start"],
                "input" => "string",
                "widget" => "single_text",
                "required" => true,"constraints" => [new Constraints\NotBlank(), new Constraints\NotNull()],
                "attr" => array()
            ])
            ->add("end_time", "time", [
                "label" => $this->translator->trans("Delivery ending time", [], LivraisonParSecteurs::MESSAGE_DOMAIN),
                "label_attr" => ["for" => "attr-area-schedule-end"],
                "input" => "string",
                "widget" => "single_text",
                "required" => true,"constraints" => [new Constraints\NotBlank(), new Constraints\NotNull()],
                "attr" => array()
            ]);
    }

    /**
     * @inheritDoc
     */
    public function getName()
    {
        return "lps-area-schedule-create";
    }
}
