<?php

namespace App\Entity;

use App\Repository\SecteurTauxRetourRepository;
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=SecteurTauxRetourRepository::class)
 * @ORM\Table(schema="sav")
 */
class SecteurTauxRetour
{
    /**
     * @ORM\Id
     * @ORM\GeneratedValue
     * @ORM\Column(type="integer")
     * @Groups({"map"})
     */
    private $id;

    /**
     * @ORM\Column(type="integer", nullable=true)
     * @Groups({"map"})
     */
    private $taux_retour;

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

    /**
     * @ORM\OneToMany(targetEntity=Secteur::class, mappedBy="secteur_taux_retour")
     * @Ignore()
     */
    private $secteurs;

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

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

    public function getTauxRetour(): ?int
    {
        return $this->taux_retour;
    }

    public function setTauxRetour(?int $taux_retour): self
    {
        $this->taux_retour = $taux_retour;

        return $this;
    }

    public function getLibelle(): ?string
    {
        return $this->libelle;
    }

    public function setLibelle(?string $libelle): self
    {
        $this->libelle = $libelle;

        return $this;
    }

    /**
     * @return Collection<int, Secteur>
     */
    public function getSecteurs(): Collection
    {
        return $this->secteurs;
    }

    public function addSecteur(Secteur $secteur): self
    {
        if (!$this->secteurs->contains($secteur)) {
            $this->secteurs[] = $secteur;
            $secteur->setSecteurTauxRetour($this);
        }

        return $this;
    }

    public function removeSecteur(Secteur $secteur): self
    {
        if ($this->secteurs->removeElement($secteur)) {
            // set the owning side to null (unless already changed)
            if ($secteur->getSecteurTauxRetour() === $this) {
                $secteur->setSecteurTauxRetour(null);
            }
        }

        return $this;
    }
}
