<?php

namespace LivraisonParSecteurs\Form;

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

/**
 * Class CitiesAddForm
 * @package LivraisonParSecteurs\Form
 */
class CitiesAddForm 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("zipcode", "integer", [
                "label" => $this->translator->trans("Zipcode", [], LivraisonParSecteurs::MESSAGE_DOMAIN),
                "label_attr" => ["for" => "attr-city-zipcode"],
                "required" => true,
                "constraints" => [new Constraints\NotBlank(), new Constraints\NotNull()],
            ])
            ->add("title", "text", [
                "label" => $this->translator->trans("City", [], LivraisonParSecteurs::MESSAGE_DOMAIN),
                "label_attr" => ["for" => "attr-city-title"],
                "required" => true,
                "constraints" => [new Constraints\NotBlank(), new Constraints\NotNull()],
                "attr" => array()
            ])
            ->add("latitude", "number", [
                "label" => $this->translator->trans("Latitude", [], LivraisonParSecteurs::MESSAGE_DOMAIN),
                "label_attr" => ["for" => "attr-city-latitude"],
                "required" => false
            ])
            ->add("longitude", "number", [
                "label" => $this->translator->trans("Longitude", [], LivraisonParSecteurs::MESSAGE_DOMAIN),
                "label_attr" => ["for" => "attr-city-longitude"],
                "required" => false
            ]);
    }

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