<?php

namespace App\Entity;

use App\Repository\InterventionMotifAnnulationRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation\Ignore;
use Symfony\Component\Serializer\Annotation\Groups;

/**
 * @ORM\Entity(repositoryClass=InterventionMotifAnnulationRepository::class)
 * @ORM\Table(schema="sav")
 */
class InterventionMotifAnnulation
{
    /**
     * @ORM\Id
     * @ORM\GeneratedValue
     * @ORM\Column(type="integer")
     * @Groups({"api"})
     */
    private $id;

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

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

    /**
     * @ORM\OneToMany(targetEntity=InterventionAnnulation::class, mappedBy="intervention_motif_annulation")
     * @Ignore()
     */
    private $interventionAnnulations;

    public function __construct()
    {
        $this->interventionAnnulations = new ArrayCollection();
    }

    public function getId(): ?int
    {
        return $this->id;
    }

    public function getLibelleCourt(): ?string
    {
        return $this->libelle_court;
    }

    public function setLibelleCourt(?string $libelle_court): self
    {
        $this->libelle_court = $libelle_court;

        return $this;
    }

    public function getLibelleLong(): ?string
    {
        return $this->libelle_long;
    }

    public function setLibelleLong(?string $libelle_long): self
    {
        $this->libelle_long = $libelle_long;

        return $this;
    }

    /**
     * @return Collection<int, InterventionAnnulation>
     */
    public function getInterventionAnnulations(): Collection
    {
        return $this->interventionAnnulations;
    }

    public function addInterventionAnnulation(InterventionAnnulation $interventionAnnulation): self
    {
        if (!$this->interventionAnnulations->contains($interventionAnnulation)) {
            $this->interventionAnnulations[] = $interventionAnnulation;
            $interventionAnnulation->setInterventionMotifAnnulation($this);
        }

        return $this;
    }

    public function removeInterventionAnnulation(InterventionAnnulation $interventionAnnulation): self
    {
        if ($this->interventionAnnulations->removeElement($interventionAnnulation)) {
            // set the owning side to null (unless already changed)
            if ($interventionAnnulation->getInterventionMotifAnnulation() === $this) {
                $interventionAnnulation->setInterventionMotifAnnulation(null);
            }
        }

        return $this;
    }
}
