<?php
declare (strict_types=1);

namespace App\ApiResources\Utils;

use ApiPlatform\Metadata\ApiResource;
use ApiPlatform\Metadata\Link;
use ApiPlatform\Metadata\GetCollection;
use ApiPlatform\Metadata\Get;
use ApiPlatform\Metadata\ApiProperty;
use App\ApiResources\ApiResourcesInterface;
use App\State\Provider\Utils\GpsCoordinateSearchingProvider;

/**
 * Classe resource qui contient les champs de recherche des coordonnées GPS d'une adresse
 */
#[ApiResource(
    operations: [
        new Get(uriTemplate: '/gps-coordinate-reverse/{latitude}/{longitude}'),
        new GetCollection(uriTemplate: '/gps-coordinate-searching')
    ],
    provider: GpsCoordinateSearchingProvider::class
)]
class GpsCoordinate implements ApiResourcesInterface
{
    #[ApiProperty(identifier: true)]
    private float $latitude;

    #[ApiProperty(identifier: true)]
    private float $longitude;

    private ?string $streetAddress = null;

    private ?string $streetAddressSecond = null;

    private ?string $streetAddressThird = null;

    private ?string $cp = null;

    private ?string $city = null;

    private ?string $country = null;

    public function __construct()
    {
        $this->setLatitude(0.0);
        $this->setLongitude(0.0);
    }

    public function setLatitude(?float $latitude): self
    {
        $this->latitude = $latitude;
        return $this;
    }

    public function getLatitude(): ?float
    {
        return $this->latitude;
    }

    public function getLongitude(): ?float
    {
        return $this->longitude;
    }

    public function setLongitude(?float $longitude): self
    {
        $this->longitude = $longitude;
        return $this;
    }

    public function getStreetAddress(): ?string
    {
        return $this->streetAddress;
    }

    public function setStreetAddress(?string $streetAddress): self
    {
        $this->streetAddress = $streetAddress;
        return $this;
    }

    public function getStreetAddressSecond(): ?string
    {
        return $this->streetAddressSecond;
    }

    public function setStreetAddressSecond(?string $streetAddressSecond): self
    {
        $this->streetAddressSecond = $streetAddressSecond;
        return $this;
    }

    public function getStreetAddressThird(): ?string
    {
        return $this->streetAddressThird;
    }

    public function setStreetAddressThird(?string $streetAddressThird): self
    {
        $this->streetAddressThird = $streetAddressThird;
        return $this;
    }

    public function getCp(): ?string
    {
        return $this->cp;
    }

    public function setCp(?string $cp): self
    {
        $this->cp = $cp;
        return $this;
    }

    public function getCity(): ?string
    {
        return $this->city;
    }

    public function setCity(?string $city): self
    {
        $this->city = $city;
        return $this;
    }

    public function getCountry(): ?string
    {
        return $this->country;
    }

    public function setCountry(?string $country): self
    {
        $this->country = $country;
        return $this;
    }
}