<?php

namespace App\Entity;

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

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

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

    /**
     * @ORM\OneToMany(targetEntity=EquipementGroupe::class, mappedBy="groupe_type", orphanRemoval=true)
     * @Ignore()
     */
    private $equipementGroupes;

    public function __construct()
    {
        $this->equipementGroupes = 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;
    }

    public function getCommentaireDev(): ?string
    {
        return $this->commentaire_dev;
    }

    public function setCommentaireDev(?string $commentaire_dev): self
    {
        $this->commentaire_dev = $commentaire_dev;

        return $this;
    }

    /**
     * @return Collection<int, EquipementGroupe>
     */
    public function getEquipementGroupes(): Collection
    {
        return $this->equipementGroupes;
    }

    public function addEquipementGroupe(EquipementGroupe $equipementGroupe): self
    {
        if (!$this->equipementGroupes->contains($equipementGroupe)) {
            $this->equipementGroupes[] = $equipementGroupe;
            $equipementGroupe->setGroupeType($this);
        }

        return $this;
    }

    public function removeEquipementGroupe(EquipementGroupe $equipementGroupe): self
    {
        if ($this->equipementGroupes->removeElement($equipementGroupe)) {
            // set the owning side to null (unless already changed)
            if ($equipementGroupe->getGroupeType() === $this) {
                $equipementGroupe->setGroupeType(null);
            }
        }

        return $this;
    }
}
