<?php

namespace App\Entity;

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

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

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

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

    /**
     * @ORM\ManyToOne(targetEntity=TypePlanification::class, inversedBy="evenementObjets")
     * @ORM\JoinColumn(nullable=false, name="idtype_planification")
     * @Groups({"site_list"})
     */
    private $type_planification;

    /**
     * @ORM\OneToMany(targetEntity=Evenement::class, mappedBy="evenement_objet")
     */
    private $evenements;

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

    public function getActif(): ?bool
    {
        return $this->actif;
    }

    public function setActif(bool $actif): self
    {
        $this->actif = $actif;

        return $this;
    }

    public function getTypePlanification(): ?TypePlanification
    {
        return $this->type_planification;
    }

    public function setTypePlanification(?TypePlanification $type_planification): self
    {
        $this->type_planification = $type_planification;

        return $this;
    }

    /**
     * @return Collection<int, Evenement>
     */
    public function getEvenements(): Collection
    {
        return $this->evenements;
    }

    public function addEvenement(Evenement $evenement): self
    {
        if (!$this->evenements->contains($evenement)) {
            $this->evenements[] = $evenement;
            $evenement->setEvenementObjet($this);
        }

        return $this;
    }

    public function removeEvenement(Evenement $evenement): self
    {
        if ($this->evenements->removeElement($evenement)) {
            // set the owning side to null (unless already changed)
            if ($evenement->getEvenementObjet() === $this) {
                $evenement->setEvenementObjet(null);
            }
        }

        return $this;
    }
}
