<?php

namespace App\Entity;

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

/**
 * @ORM\Entity(repositoryClass=UtilisateurProfilRepository::class)
 * @ORM\Table(schema="sav")
 */
class UtilisateurProfil
{
    const ID_PLANNING = 8;
    const ID_POLY_PLANNING = 9;
    const ID_AGENT = 11;
    const ID_RESPONSABLE_SECTEUR = 10;
    /**
     * @ORM\Id
     * @ORM\GeneratedValue
     * @ORM\Column(type="integer")
     */
    private $id;

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

    /**
     * @ORM\Column(type="boolean", options={"default" = 0})
     */
    private $calcul_attachement;

    /**
     * @ORM\OneToMany(targetEntity=AttachementProfil::class, mappedBy="utilisateur_profil")
     * @Ignore()
     */
    private $attachementProfils;

    /**
     * @ORM\OneToMany(targetEntity=UtilisateurAffectation::class, mappedBy="utilisateur_profil")
     * @Ignore()
     */
    private $utilisateurAffectations;

    public function __construct()
    {
        $this->attachementProfils = new ArrayCollection();
        $this->utilisateurAffectations = 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 getCalculAttachement(): ?bool
    {
        return $this->calcul_attachement;
    }

    public function setCalculAttachement(bool $calcul_attachement): self
    {
        $this->calcul_attachement = $calcul_attachement;

        return $this;
    }

    /**
     * @return Collection|AttachementProfil[]
     */
    public function getAttachementProfils(): Collection
    {
        return $this->attachementProfils;
    }

    public function addAttachementProfil(AttachementProfil $attachementProfil): self
    {
        if (!$this->attachementProfils->contains($attachementProfil)) {
            $this->attachementProfils[] = $attachementProfil;
            $attachementProfil->setUtilisateurProfil($this);
        }

        return $this;
    }

    public function removeAttachementProfil(AttachementProfil $attachementProfil): self
    {
        if ($this->attachementProfils->removeElement($attachementProfil)) {
            // set the owning side to null (unless already changed)
            if ($attachementProfil->getUtilisateurProfil() === $this) {
                $attachementProfil->setUtilisateurProfil(null);
            }
        }

        return $this;
    }

    /**
     * @return Collection|UtilisateurAffectation[]
     */
    public function getUtilisateurAffectations(): Collection
    {
        return $this->utilisateurAffectations;
    }

    public function addUtilisateurAffectation(UtilisateurAffectation $utilisateurAffectation): self
    {
        if (!$this->utilisateurAffectations->contains($utilisateurAffectation)) {
            $this->utilisateurAffectations[] = $utilisateurAffectation;
            $utilisateurAffectation->setUtilisateurProfil($this);
        }

        return $this;
    }

    public function removeUtilisateurAffectation(UtilisateurAffectation $utilisateurAffectation): self
    {
        if ($this->utilisateurAffectations->removeElement($utilisateurAffectation)) {
            // set the owning side to null (unless already changed)
            if ($utilisateurAffectation->getUtilisateurProfil() === $this) {
                $utilisateurAffectation->setUtilisateurProfil(null);
            }
        }

        return $this;
    }
}
