<?php

namespace App\Entity;

use App\Repository\EvenementLieuRepository;
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=EvenementLieuRepository::class)
 * @ORM\Table(schema="sav")
 */
class EvenementLieu
{
    /**
     * @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=Site::class, inversedBy="evenementLieus")
     * @ORM\JoinColumn(nullable=false, name="idsite")
     * @Groups({"site_list"})
     */
    private $site;

    /**
     * @ORM\OneToMany(targetEntity=EvenementLieuTypePlanification::class, mappedBy="evenement_lieu")
     */
    private $evenementLieuTypePlanifications;

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

    public function __construct()
    {
        $this->evenementLieuTypePlanifications = new ArrayCollection();
        $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 getSite(): ?Site
    {
        return $this->site;
    }

    public function setSite(?Site $site): self
    {
        $this->site = $site;

        return $this;
    }

    /**
     * @return Collection<int, EvenementLieuTypePlanification>
     */
    public function getEvenementLieuTypePlanifications(): Collection
    {
        return $this->evenementLieuTypePlanifications;
    }

    public function addEvenementLieuTypePlanification(EvenementLieuTypePlanification $evenementLieuTypePlanification): self
    {
        if (!$this->evenementLieuTypePlanifications->contains($evenementLieuTypePlanification)) {
            $this->evenementLieuTypePlanifications[] = $evenementLieuTypePlanification;
            $evenementLieuTypePlanification->setEvenementLieu($this);
        }

        return $this;
    }

    public function removeEvenementLieuTypePlanification(EvenementLieuTypePlanification $evenementLieuTypePlanification): self
    {
        if ($this->evenementLieuTypePlanifications->removeElement($evenementLieuTypePlanification)) {
            // set the owning side to null (unless already changed)
            if ($evenementLieuTypePlanification->getEvenementLieu() === $this) {
                $evenementLieuTypePlanification->setEvenementLieu(null);
            }
        }

        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->setEvenementLieu($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->getEvenementLieu() === $this) {
                $evenement->setEvenementLieu(null);
            }
        }

        return $this;
    }
}
