<?php

namespace App\Entity;

use App\Repository\InstallateurRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation\Ignore;
use Symfony\Component\Serializer\Annotation\Groups;

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

    /**
     * @ORM\Column(type="string", length=9, nullable=true)
     * @Groups({"api"})
     */
    private $code_agi;

    /**
     * @ORM\Column(type="string", length=30, nullable=true)
     * @Groups({"api"})
     */
    private $nom;

    /**
     * @ORM\Column(type="string", length=35, nullable=true)
     * @Groups({"api"})
     */
    private $adresse1;

    /**
     * @ORM\Column(type="string", length=35, nullable=true)
     * @Groups({"api"})
     */
    private $adresse2;

    /**
     * @ORM\Column(type="string", length=5, nullable=true)
     * @Groups({"api"})
     */
    private $code_postal;

    /**
     * @ORM\Column(type="string", length=50, nullable=true)
     * @Groups({"api"})
     */
    private $ville;

    /**
     * @ORM\Column(type="string", length=14, nullable=true)
     * @Groups({"api"})
     */
    private $tel1;

    /**
     * @ORM\Column(type="string", length=14, nullable=true)
     * @Groups({"api"})
     */
    private $tel2;

    /**
     * @ORM\Column(type="string", length=260, nullable=true)
     * @Groups({"api"})
     */
    private $email;

    /**
     * @ORM\Column(type="boolean", nullable=true)
     * @Groups({"api"})
     */
    private $gere_sav;

    /**
     * @ORM\OneToMany(targetEntity=Equipement::class, mappedBy="installateur")
     * @Ignore()
     */
    private $equipements;

    public function __construct()
    {
        $this->equipements = new ArrayCollection();
    }

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

    public function getCodeAgi(): ?string
    {
        return $this->code_agi;
    }

    public function setCodeAgi(?string $code_agi): self
    {
        $this->code_agi = $code_agi;

        return $this;
    }

    public function getNom(): ?string
    {
        return $this->nom;
    }

    public function setNom(?string $nom): self
    {
        $this->nom = $nom;

        return $this;
    }

    public function getAdresse1(): ?string
    {
        return $this->adresse1;
    }

    public function setAdresse1(?string $adresse1): self
    {
        $this->adresse1 = $adresse1;

        return $this;
    }

    public function getAdresse2(): ?string
    {
        return $this->adresse2;
    }

    public function setAdresse2(?string $adresse2): self
    {
        $this->adresse2 = $adresse2;

        return $this;
    }

    public function getCodePostal(): ?string
    {
        return $this->code_postal;
    }

    public function setCodePostal(?string $code_postal): self
    {
        $this->code_postal = $code_postal;

        return $this;
    }

    public function getVille(): ?string
    {
        return $this->ville;
    }

    public function setVille(?string $ville): self
    {
        $this->ville = $ville;

        return $this;
    }

    public function getTel1(): ?string
    {
        return $this->tel1;
    }

    public function setTel1(?string $tel1): self
    {
        $this->tel1 = $tel1;

        return $this;
    }

    public function getTel2(): ?string
    {
        return $this->tel2;
    }

    public function setTel2(?string $tel2): self
    {
        $this->tel2 = $tel2;

        return $this;
    }

    public function getEmail(): ?string
    {
        return $this->email;
    }

    public function setEmail(?string $email): self
    {
        $this->email = $email;

        return $this;
    }

    public function getGereSav(): ?bool
    {
        return $this->gere_sav;
    }

    public function setGereSav(?bool $gere_sav): self
    {
        $this->gere_sav = $gere_sav;

        return $this;
    }

    /**
     * @return Collection<int, Equipement>
     */
    public function getEquipements(): Collection
    {
        return $this->equipements;
    }

    public function addEquipement(Equipement $equipement): self
    {
        if (!$this->equipements->contains($equipement)) {
            $this->equipements[] = $equipement;
            $equipement->setInstallateur($this);
        }

        return $this;
    }

    public function removeEquipement(Equipement $equipement): self
    {
        if ($this->equipements->removeElement($equipement)) {
            // set the owning side to null (unless already changed)
            if ($equipement->getInstallateur() === $this) {
                $equipement->setInstallateur(null);
            }
        }

        return $this;
    }
}
