<?php

namespace App\Request\Restaurant;

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="RequestListRestaurant"
 * )
 */
class RequestListRestaurant
{
    public function __construct(Request $request)
    {
        $this->setKey($request->get('key'));
        $this->setPostalCode($request->get('postalCode'));
        $this->setLatitude($request->get('latitude'));
        $this->setLongitude($request->get('longitude'));
    }

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

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

    /**
     * @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 min = 1,
     */
    public function getKey()
    {
        return $this->key;
    }

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

        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 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 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;
    }
}
