<?php

namespace App\Request\UserAddress;

use App\Entity\Category;
use OpenApi\Annotations as OA;
use App\Traits\TranslatorTrait;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Component\Validator\Context\ExecutionContextInterface;

/**
 * @OA\Schema(
 *      title="RequestAddAddress"
 * )
 */
class RequestAddAddress
{
    public function __construct(Request $request)
    {
        $this->setName($request->get('name'));
        $this->setPostalCode($request->get('postalCode'));
        $this->setApartment($request->get('apartment'));
        $this->setHouseNumber($request->get('houseNumber'));
        $this->setStreet($request->get('street'));
        $this->setLatitude($request->get('latitude'));
        $this->setLongitude($request->get('longitude'));
    }

    /**
     * @Assert\NotBlank()
     * @Assert\Length(
     *      min = 1,
     *      max = 50
     * )
     * @OA\Property(type="string")
     * */
    private $name;

    /**
     * @Assert\NotBlank()
     * @Assert\Length(
     *      min = 1,
     *      max = 9
     * )
     * @OA\Property(type="string")
     * */
    private $postalCode;

    /**
     * @Assert\NotBlank()
     * @Assert\Length(
     *      min = 1,
     *      max = 20
     * )
     * @OA\Property(type="string")
     * */
    private $apartment;

    /**
     * @Assert\NotBlank()
     * @Assert\Length(
     *      max = 1,
     *      max = 20
     * )
     * @OA\Property(type="string")
     * */
    private $houseNumber;

    /**
     * @Assert\NotBlank()
     * @Assert\Length(
     *      min = 1,
     *      max = 50
     * )
     * @OA\Property(type="string")
     * */
    private $street;

    /**
     * @Assert\Regex("/^[-]?((((1[0-7][0-9])|([0-9]?[0-9]))\.(\d+))|180(\.0+)?)$/")
     * @OA\Property(type="string", example="32.63936092")
     */
    private $latitude;

    /**
     * @Assert\Regex("/^[-]?((((1[0-7][0-9])|([0-9]?[0-9]))\.(\d+))|180(\.0+)?)$/")
     * @OA\Property(type="string", example="-16.9329066")
     */
    private $longitude;

    /**
     * Get the value of longitude
     */
    public function getLongitude()
    {
        return $this->longitude;
    }

    /**
     * Set the value of longitude
     *
     * @return  self
     */
    public function setLongitude($longitude)
    {
        $this->longitude = $longitude;

        return $this;
    }

    /**
     * Get the value of latitude
     */
    public function getLatitude()
    {
        return $this->latitude;
    }

    /**
     * Set the value of latitude
     *
     * @return  self
     */
    public function setLatitude($latitude)
    {
        $this->latitude = $latitude;

        return $this;
    }

    /**
     * Get min = 1,
     */
    public function getStreet()
    {
        return $this->street;
    }

    /**
     * Set min = 1,
     *
     * @return  self
     */
    public function setStreet($street)
    {
        $this->street = $street;

        return $this;
    }

    /**
     * Get max = 1
     */
    public function getHouseNumber()
    {
        return $this->houseNumber;
    }

    /**
     * Set max = 1
     *
     * @return  self
     */
    public function setHouseNumber($houseNumber)
    {
        $this->houseNumber = $houseNumber;

        return $this;
    }

    /**
     * Get min = 1,
     */
    public function getApartment()
    {
        return $this->apartment;
    }

    /**
     * Set min = 1,
     *
     * @return  self
     */
    public function setApartment($apartment)
    {
        $this->apartment = $apartment;

        return $this;
    }

    /**
     * Get min = 1
     */
    public function getPostalCode()
    {
        return $this->postalCode;
    }

    /**
     * Set min = 1
     *
     * @return  self
     */
    public function setPostalCode($postalCode)
    {
        $this->postalCode = $postalCode;

        return $this;
    }

    /**
     * Get min = 1
     */
    public function getName()
    {
        return $this->name;
    }

    /**
     * Set min = 1
     *
     * @return  self
     */
    public function setName($name)
    {
        $this->name = $name;

        return $this;
    }
}
