<?php

namespace App\Entity;

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

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

    /**
     * @ORM\OneToMany(targetEntity=ClassificationEnergetique::class, mappedBy="classe_rendement")
     */
    private $classificationEnergetiques;

    public function __construct()
    {
        $this->classificationEnergetiques = 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, ClassificationEnergetique>
     */
    public function getClassificationEnergetiques(): Collection
    {
        return $this->classificationEnergetiques;
    }

    public function addClassificationEnergetique(ClassificationEnergetique $classificationEnergetique): self
    {
        if (!$this->classificationEnergetiques->contains($classificationEnergetique)) {
            $this->classificationEnergetiques[] = $classificationEnergetique;
            $classificationEnergetique->setClasseRendement($this);
        }

        return $this;
    }

    public function removeClassificationEnergetique(ClassificationEnergetique $classificationEnergetique): self
    {
        if ($this->classificationEnergetiques->removeElement($classificationEnergetique)) {
            // set the owning side to null (unless already changed)
            if ($classificationEnergetique->getClasseRendement() === $this) {
                $classificationEnergetique->setClasseRendement(null);
            }
        }

        return $this;
    }
}
