<?php

namespace App\Entity;

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

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

    /**
     * @ORM\OneToMany(targetEntity=ContratTarif::class, mappedBy="contrat_plage")
     * @Ignore()
     */
    private $contratTarifs;

    /**
     * @ORM\OneToMany(targetEntity=OptionTarif::class, mappedBy="contrat_plage")
     * @Ignore()
     */
    private $optionTarifs;

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

    /**
     * @ORM\Column(type="integer", nullable=true)
     */
    private $min;

    /**
     * @ORM\Column(type="integer", nullable=true)
     */
    private $max;

    public function __construct()
    {
        $this->contratTarifs = new ArrayCollection();
        $this->optionTarifs = 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|ContratTarif[]
     */
    public function getContratTarifs(): Collection
    {
        return $this->contratTarifs;
    }

    public function addContratTarif(ContratTarif $contratTarif): self
    {
        if (!$this->contratTarifs->contains($contratTarif)) {
            $this->contratTarifs[] = $contratTarif;
            $contratTarif->setContratPlage($this);
        }

        return $this;
    }

    public function removeContratTarif(ContratTarif $contratTarif): self
    {
        if ($this->contratTarifs->removeElement($contratTarif)) {
            // set the owning side to null (unless already changed)
            if ($contratTarif->getContratPlage() === $this) {
                $contratTarif->setContratPlage(null);
            }
        }

        return $this;
    }

    /**
     * @return Collection|OptionTarif[]
     */
    public function getOptionTarifs(): Collection
    {
        return $this->optionTarifs;
    }

    public function addOptionTarif(OptionTarif $optionTarif): self
    {
        if (!$this->optionTarifs->contains($optionTarif)) {
            $this->optionTarifs[] = $optionTarif;
            $optionTarif->setContratPlage($this);
        }

        return $this;
    }

    public function removeOptionTarif(OptionTarif $optionTarif): self
    {
        if ($this->optionTarifs->removeElement($optionTarif)) {
            // set the owning side to null (unless already changed)
            if ($optionTarif->getContratPlage() === $this) {
                $optionTarif->setContratPlage(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->setContratPlage($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->getContratPlage() === $this) {
                $produitPrestationTarif->setContratPlage(null);
            }
        }

        return $this;
    }

    public function getMin(): ?int
    {
        return $this->min;
    }

    public function setMin(?int $min): self
    {
        $this->min = $min;

        return $this;
    }

    public function getMax(): ?int
    {
        return $this->max;
    }

    public function setMax(?int $max): self
    {
        $this->max = $max;

        return $this;
    }
}
