<?php

namespace App\Entity;

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

    /**
     * @ORM\OneToMany(targetEntity=InterventionAnomalie::class, mappedBy="anomalie")
     */
    private $interventionAnomalies;

    /**
     * @ORM\ManyToOne(targetEntity=AnomalieCategorie::class, inversedBy="anomalies")
     * @ORM\JoinColumn(nullable=false, name="idanomalie_categorie")
     * @Groups({"api"})
     */
    private $anomalie_categorie;

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

    /**
     * @ORM\Column(type="text", nullable=true)
     * @Groups({"api"})
     */
    private $verifications;

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

    /**
     * @ORM\Column(type="obligation_courrier")
     */
    private $obligation_courrier;

    /**
     * @ORM\Column(type="boolean")
     * @Groups({"api"})
     */
    private $shutdown;

    /**
     * @ORM\Column(type="boolean")
     * @Groups({"api"})
     */
    private $make_modif;

    /**
     * @ORM\Column(type="text", nullable=true)
     * @Groups({"api"})
     */
    private $annotation_fit;

    /**
     * @ORM\Column(type="boolean")
     * @Groups({"api"})
     */
    private $contrat_possible;

    /**
     * @ORM\Column(type="boolean")
     * @Groups({"api"})
     */
    private $entretien_possible;

    /**
     * @ORM\Column(type="boolean")
     * @Groups({"api"})
     */
    private $depannage_possible;

    /**
     * @ORM\ManyToOne(targetEntity=AnomalieClassification::class, inversedBy="anomaliesNeuve")
     * @ORM\JoinColumn(nullable=false, name="idanomalie_classification_neuve")
     * @Groups({"api"})
     */
    private $anomalie_classification_neuve;

    /**
     * @ORM\ManyToOne(targetEntity=AnomalieClassification::class, inversedBy="anomaliesAncien")
     * @ORM\JoinColumn(nullable=false, name="idanomalie_classification_ancien")
     * @Groups({"api"})
     */
    private $anomalie_classification_ancien;

    /**
     * @ORM\ManyToOne(targetEntity=AnomalieProContact::class, inversedBy="anomalies")
     * @ORM\JoinColumn(nullable=false, name="idanomalie_pro_contact")
     * @Groups({"api"})
     */
    private $anomalie_pro_contact;

    /**
     * @ORM\ManyToOne(targetEntity=AnomalieCoupureGaz::class, inversedBy="anomalies")
     * @ORM\JoinColumn(nullable=false, name="idanomalie_coupure_gaz")
     * @Groups({"api"})
     */
    private $anomalie_coupure_gaz;

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

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

    /**
     * @return Collection<int, InterventionAnomalie>
     */
    public function getInterventionAnomalies(): Collection
    {
        return $this->interventionAnomalies;
    }

    public function addInterventionAnomaly(InterventionAnomalie $interventionAnomaly): self
    {
        if (!$this->interventionAnomalies->contains($interventionAnomaly)) {
            $this->interventionAnomalies[] = $interventionAnomaly;
            $interventionAnomaly->setAnomalie($this);
        }

        return $this;
    }

    public function removeInterventionAnomaly(InterventionAnomalie $interventionAnomaly): self
    {
        if ($this->interventionAnomalies->removeElement($interventionAnomaly)) {
            // set the owning side to null (unless already changed)
            if ($interventionAnomaly->getAnomalie() === $this) {
                $interventionAnomaly->setAnomalie(null);
            }
        }

        return $this;
    }

    public function getAnomalieCategorie(): ?AnomalieCategorie
    {
        return $this->anomalie_categorie;
    }

    public function setAnomalieCategorie(?AnomalieCategorie $anomalie_categorie): self
    {
        $this->anomalie_categorie = $anomalie_categorie;

        return $this;
    }

    public function getLibelle(): ?string
    {
        return $this->libelle;
    }

    public function setLibelle(string $libelle): self
    {
        $this->libelle = $libelle;

        return $this;
    }

    public function getVerifications(): ?string
    {
        return $this->verifications;
    }

    public function setVerifications(?string $verifications): self
    {
        $this->verifications = $verifications;

        return $this;
    }

    public function getAnnotationCourrier(): ?string
    {
        return $this->annotation_courrier;
    }

    public function setAnnotationCourrier(?string $annotation_courrier): self
    {
        $this->annotation_courrier = $annotation_courrier;

        return $this;
    }

    public function getObligationCourrier()
    {
        return $this->obligation_courrier;
    }

    public function setObligationCourrier($obligation_courrier): self
    {
        $this->obligation_courrier = $obligation_courrier;

        return $this;
    }

    public function getShutdown(): ?bool
    {
        return $this->shutdown;
    }

    public function setShutdown(bool $shutdown): self
    {
        $this->shutdown = $shutdown;

        return $this;
    }

    public function getMakeModif(): ?bool
    {
        return $this->make_modif;
    }

    public function setMakeModif(bool $make_modif): self
    {
        $this->make_modif = $make_modif;

        return $this;
    }

    public function getAnnotationFit(): ?string
    {
        return $this->annotation_fit;
    }

    public function setAnnotationFit(?string $annotation_fit): self
    {
        $this->annotation_fit = $annotation_fit;

        return $this;
    }

    public function getContratPossible(): ?bool
    {
        return $this->contrat_possible;
    }

    public function setContratPossible(bool $contrat_possible): self
    {
        $this->contrat_possible = $contrat_possible;

        return $this;
    }

    public function getEntretienPossible(): ?bool
    {
        return $this->entretien_possible;
    }

    public function setEntretienPossible(bool $entretien_possible): self
    {
        $this->entretien_possible = $entretien_possible;

        return $this;
    }

    public function getDepannagePossible(): ?bool
    {
        return $this->depannage_possible;
    }

    public function setDepannagePossible(bool $depannage_possible): self
    {
        $this->depannage_possible = $depannage_possible;

        return $this;
    }

    public function getAnomalieClassificationNeuve(): ?AnomalieClassification
    {
        return $this->anomalie_classification_neuve;
    }

    public function setAnomalieClassificationNeuve(?AnomalieClassification $anomalie_classification_neuve): self
    {
        $this->anomalie_classification_neuve = $anomalie_classification_neuve;

        return $this;
    }

    public function getAnomalieClassificationAncien(): ?AnomalieClassification
    {
        return $this->anomalie_classification_ancien;
    }

    public function setAnomalieClassificationAncien(?AnomalieClassification $anomalie_classification_ancien): self
    {
        $this->anomalie_classification_ancien = $anomalie_classification_ancien;

        return $this;
    }

    public function getAnomalieProContact(): ?AnomalieProContact
    {
        return $this->anomalie_pro_contact;
    }

    public function setAnomalieProContact(?AnomalieProContact $anomalie_pro_contact): self
    {
        $this->anomalie_pro_contact = $anomalie_pro_contact;

        return $this;
    }

    public function getAnomalieCoupureGaz(): ?AnomalieCoupureGaz
    {
        return $this->anomalie_coupure_gaz;
    }

    public function setAnomalieCoupureGaz(?AnomalieCoupureGaz $anomalie_coupure_gaz): self
    {
        $this->anomalie_coupure_gaz = $anomalie_coupure_gaz;

        return $this;
    }
}
