<?php

namespace App\Entity;

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

/**
 * @ORM\Entity(repositoryClass=ContratRegroupementRepository::class)
 * @ORM\Table(schema="sav")
 */
class ContratRegroupement
{
    /**
     * @ORM\Id
     * @ORM\GeneratedValue
     * @ORM\Column(type="integer")
     */
    private $id;

    /**
     * @ORM\Column(type="string", length=30)
     */
    private $libelle;

    /**
     * @ORM\OneToMany(targetEntity=ContratType::class, mappedBy="contrat_regroupement")
     * @Ignore()
     */
    private $contratTypes;

    /**
     * @ORM\OneToMany(targetEntity=ProduitPrestationTarif::class, mappedBy="contrat_regroupement")
     * @Ignore()
     */
    private $produitPrestationTarifs;

    public function __construct()
    {
        $this->contratTypes = new ArrayCollection();
        $this->produitPrestationTarifs = 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|ContratType[]
     */
    public function getContratTypes(): Collection
    {
        return $this->contratTypes;
    }

    public function addContratType(ContratType $contratType): self
    {
        if (!$this->contratTypes->contains($contratType)) {
            $this->contratTypes[] = $contratType;
            $contratType->setContratRegroupement($this);
        }

        return $this;
    }

    public function removeContratType(ContratType $contratType): self
    {
        if ($this->contratTypes->removeElement($contratType)) {
            // set the owning side to null (unless already changed)
            if ($contratType->getContratRegroupement() === $this) {
                $contratType->setContratRegroupement(null);
            }
        }

        return $this;
    }

    /**
     * @return Collection|ProduitPrestationTarif[]
     */
    public function getProduitPrestationTarifs(): Collection
    {
        return $this->produitPrestationTarifs;
    }

    public function addProduitPrestationTarif(ProduitPrestationTarif $produitPrestationTarif): self
    {
        if (!$this->produitPrestationTarifs->contains($produitPrestationTarif)) {
            $this->produitPrestationTarifs[] = $produitPrestationTarif;
            $produitPrestationTarif->setContratRegroupement($this);
        }

        return $this;
    }

    public function removeProduitPrestationTarif(ProduitPrestationTarif $produitPrestationTarif): self
    {
        if ($this->produitPrestationTarifs->removeElement($produitPrestationTarif)) {
            // set the owning side to null (unless already changed)
            if ($produitPrestationTarif->getContratRegroupement() === $this) {
                $produitPrestationTarif->setContratRegroupement(null);
            }
        }

        return $this;
    }
}
