<?php

namespace PointRetrait\Form;

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

/**
 * Class ViewScheduleForm
 * @package PointRetrait\Form
 */
class ViewScheduleForm extends BaseForm
{
    /**
     * @inheritDoc
     */
    protected function buildForm()
    {
        $this->formBuilder
            ->add(
                "place_id","integer", [
                "label_attr" => ["for" => "attr-place-id"],
                "required" => true,
                "constraints" => [new Constraints\NotBlank()]
            ])
            ->add("day", "choice", [
                "choices" => PointRetrait::getDayLabel(null),
                "label" => $this->translator->trans("Delivery day", [], PointRetrait::MESSAGE_DOMAIN),
                "label_attr" => ["for" => "attr-place-schedule-day"],
                "required" => true,
                "multiple" => false,
                "constraints" => [new Constraints\NotBlank()],
                "attr" => array()
            ])
            ->add("begin_time", "time", [
                "label" => $this->translator->trans("Delivery beginning time", [], PointRetrait::MESSAGE_DOMAIN),
                "label_attr" => ["for" => "attr-place-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", [], PointRetrait::MESSAGE_DOMAIN),
                "label_attr" => ["for" => "attr-place-schedule-end"],
                "input" => "string",
                "widget" => "single_text",
                "required" => true,"constraints" => [new Constraints\NotBlank(), new Constraints\NotNull()],
                "attr" => array()
            ]);
    }

    /**
     * @inheritDoc
     */
    public function getName()
    {
        return "pdr-place-view-schedule";
    }
}
