<?php

namespace App\Entity;

use App\Repository\AgentGpsRepository;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation\Groups;
use Symfony\Component\Serializer\Annotation\SerializedName;

/**
 * @ORM\Entity(repositoryClass=AgentGpsRepository::class)
 * @ORM\Table(schema="sav")
 */
class AgentGps
{
    /**
     * @ORM\Id
     * @ORM\GeneratedValue
     * @ORM\Column(type="integer")
     * @Groups({"map"})
     */
    private $id;

    /**
     * @ORM\Column(type="datetime")
     * @Groups({"map"})
     */
    private $date_heure;

    /**
     * @ORM\Column(type="float")
     * @Groups({"map"})
     */
    private $latitude;

    /**
     * @ORM\Column(type="float")
     * @Groups({"map"})
     */
    private $longitude;

    /**
     * @ORM\ManyToOne(targetEntity=Utilisateur::class, inversedBy="agentGps")
     * @ORM\JoinColumn(nullable=false, name="idutilisateur_agent")
     * @Groups({"map"})
     */
    private $utilisateur_agent;

    /**
     * @ORM\Column(type="float")
     * @Groups({"map"})
     */
    private $radius;

    public function getId(): ?int
    {
        return $this->id;
    }

    public function getDateHeure(): ?\DateTimeInterface
    {
        return $this->date_heure;
    }

    public function setDateHeure(\DateTimeInterface $date_heure): self
    {
        $this->date_heure = $date_heure;

        return $this;
    }

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

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

        return $this;
    }

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

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

        return $this;
    }

    public function getUtilisateurAgent(): ?Utilisateur
    {
        return $this->utilisateur_agent;
    }

    public function setUtilisateurAgent(?Utilisateur $utilisateur_agent): self
    {
        $this->utilisateur_agent = $utilisateur_agent;

        return $this;
    }

    public function getRadius(): ?float
    {
        return $this->radius;
    }

    public function setRadius(float $radius): self
    {
        $this->radius = $radius;

        return $this;
    }

    /**
     * @SerializedName("coordonnees")
     * @Groups({"map"})
     */
    public function getCoordonnees() {
        return [$this->getLongitude(), $this->getLatitude()];
    }
}
