<?php

namespace App\Entity;

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

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

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

    /**
     * @ORM\OneToMany(targetEntity=PlanningInitiativeDetail::class, mappedBy="planning_initiative_type")
     */
    private $planningInitiativeDetails;

    /**
     * @ORM\OneToMany(targetEntity=Planning::class, mappedBy="planning_initiative_type")
     */
    private $plannings;

    /**
     * @ORM\OneToMany(targetEntity=PlanningHistoriqueModification::class, mappedBy="planning_initiative_type")
     */
    private $planningHistoriqueModifications;

    public function __construct()
    {
        $this->planningInitiativeDetails = new ArrayCollection();
        $this->plannings = new ArrayCollection();
        $this->planningHistoriqueModifications = 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;
    }

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

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

        return $this;
    }

    /**
     * @return Collection<int, PlanningInitiativeDetail>
     */
    public function getPlanningInitiativeDetails(): Collection
    {
        return $this->planningInitiativeDetails;
    }

    public function addPlanningInitiativeDetail(PlanningInitiativeDetail $planningInitiativeDetail): self
    {
        if (!$this->planningInitiativeDetails->contains($planningInitiativeDetail)) {
            $this->planningInitiativeDetails[] = $planningInitiativeDetail;
            $planningInitiativeDetail->setPlanningInitiativeType($this);
        }

        return $this;
    }

    public function removePlanningInitiativeDetail(PlanningInitiativeDetail $planningInitiativeDetail): self
    {
        if ($this->planningInitiativeDetails->removeElement($planningInitiativeDetail)) {
            // set the owning side to null (unless already changed)
            if ($planningInitiativeDetail->getPlanningInitiativeType() === $this) {
                $planningInitiativeDetail->setPlanningInitiativeType(null);
            }
        }

        return $this;
    }

    /**
     * @return Collection<int, Planning>
     */
    public function getPlannings(): Collection
    {
        return $this->plannings;
    }

    public function addPlanning(Planning $planning): self
    {
        if (!$this->plannings->contains($planning)) {
            $this->plannings[] = $planning;
            $planning->setPlanningInitiativeType($this);
        }

        return $this;
    }

    public function removePlanning(Planning $planning): self
    {
        if ($this->plannings->removeElement($planning)) {
            // set the owning side to null (unless already changed)
            if ($planning->getPlanningInitiativeType() === $this) {
                $planning->setPlanningInitiativeType(null);
            }
        }

        return $this;
    }

    /**
     * @return Collection<int, PlanningHistoriqueModification>
     */
    public function getPlanningHistoriqueModifications(): Collection
    {
        return $this->planningHistoriqueModifications;
    }

    public function addPlanningHistoriqueModification(PlanningHistoriqueModification $planningHistoriqueModification): self
    {
        if (!$this->planningHistoriqueModifications->contains($planningHistoriqueModification)) {
            $this->planningHistoriqueModifications[] = $planningHistoriqueModification;
            $planningHistoriqueModification->setPlanningInitiativeType($this);
        }

        return $this;
    }

    public function removePlanningHistoriqueModification(PlanningHistoriqueModification $planningHistoriqueModification): self
    {
        if ($this->planningHistoriqueModifications->removeElement($planningHistoriqueModification)) {
            // set the owning side to null (unless already changed)
            if ($planningHistoriqueModification->getPlanningInitiativeType() === $this) {
                $planningHistoriqueModification->setPlanningInitiativeType(null);
            }
        }

        return $this;
    }
}
