<?php

namespace App\Entity;

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

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

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

    /**
     * @ORM\OneToMany(targetEntity=Retour::class, mappedBy="type_retour")
     */
    private $retours;

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

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

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

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

        return $this;
    }

    /**
     * @return Collection<int, Retour>
     */
    public function getRetours(): Collection
    {
        return $this->retours;
    }

    public function addRetour(Retour $retour): self
    {
        if (!$this->retours->contains($retour)) {
            $this->retours[] = $retour;
            $retour->setTypeRetour($this);
        }

        return $this;
    }

    public function removeRetour(Retour $retour): self
    {
        if ($this->retours->removeElement($retour)) {
            // set the owning side to null (unless already changed)
            if ($retour->getTypeRetour() === $this) {
                $retour->setTypeRetour(null);
            }
        }

        return $this;
    }
}
