<?php

namespace App\Entity;

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

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

    /**
     * @ORM\OneToMany(targetEntity=Anomalie::class, mappedBy="anomalie_classification_neuve")
     */
    private $anomaliesNeuve;

    /**
     * @ORM\OneToMany(targetEntity=Anomalie::class, mappedBy="anomalie_classification_ancien")
     */
    private $anomaliesAncien;

    public function __construct()
    {
        $this->anomaliesNeuve = new ArrayCollection();
        $this->anomaliesAncien = 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, Anomalie>
     */
    public function getAnomaliesNeuve(): Collection
    {
        return $this->anomaliesNeuve;
    }

    public function addAnomalieNeuve(Anomalie $anomalieNeuve): self
    {
        if (!$this->anomaliesNeuve->contains($anomalieNeuve)) {
            $this->anomaliesNeuve[] = $anomalieNeuve;
            $anomalieNeuve->setAnomalieClassificationNeuve($this);
        }

        return $this;
    }

    public function removeAnomalieNeuve(Anomalie $anomalieNeuve): self
    {
        if ($this->anomaliesNeuve->removeElement($anomalieNeuve)) {
            // set the owning side to null (unless already changed)
            if ($anomalieNeuve->getAnomalieClassificationNeuve() === $this) {
                $anomalieNeuve->setAnomalieClassificationNeuve(null);
            }
        }

        return $this;
    }

    /**
     * @return Collection<int, Anomalie>
     */
    public function getAnomaliesAncien(): Collection
    {
        return $this->anomaliesAncien;
    }

    public function addAnomalieAncien(Anomalie $anomalieAncien): self
    {
        if (!$this->anomaliesAncien->contains($anomalieAncien)) {
            $this->anomaliesAncien[] = $anomalieNeuve;
            $anomalieAncien->setAnomalieClassificationNeuve($this);
        }

        return $this;
    }

    public function removeAnomalieAncien(Anomalie $anomalieAncien): self
    {
        if ($this->anomaliesAncien->removeElement($anomalieAncien)) {
            // set the owning side to null (unless already changed)
            if ($anomalieAncien->getAnomalieClassificationNeuve() === $this) {
                $anomalieAncien->setAnomalieClassificationNeuve(null);
            }
        }

        return $this;
    }
}
