<?php

namespace App\Entity;

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

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

    /**
     * @ORM\OneToMany(targetEntity=AttestationEntretienPointControle::class, mappedBy="motif_debit_gaz")
     */
    private $attestationEntretienPointControles;

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

    public function addAttestationEntretienPointControle(AttestationEntretienPointControle $attestationEntretienPointControle): self
    {
        if (!$this->attestationEntretienPointControles->contains($attestationEntretienPointControle)) {
            $this->attestationEntretienPointControles[] = $attestationEntretienPointControle;
            $attestationEntretienPointControle->setMotifDebitGaz($this);
        }

        return $this;
    }

    public function removeAttestationEntretienPointControle(AttestationEntretienPointControle $attestationEntretienPointControle): self
    {
        if ($this->attestationEntretienPointControles->removeElement($attestationEntretienPointControle)) {
            // set the owning side to null (unless already changed)
            if ($attestationEntretienPointControle->getMotifDebitGaz() === $this) {
                $attestationEntretienPointControle->setMotifDebitGaz(null);
            }
        }

        return $this;
    }
}
