<?php

namespace App\Entity;

use App\Repository\UtilisateurAffectationRepository;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation\Ignore;

/**
 * @ORM\Entity(repositoryClass=UtilisateurAffectationRepository::class)
 * @ORM\Table(schema="sav")
 */
class UtilisateurAffectation
{
    /**
     * @ORM\Id
     * @ORM\GeneratedValue
     * @ORM\Column(type="integer")
     */
    private $id;

    /**
     * @ORM\ManyToOne(targetEntity=Utilisateur::class, inversedBy="utilisateurAffectations")
     * @ORM\JoinColumn(nullable=false, name="idutilisateur")
     * @Ignore()
     */
    private $utilisateur;

    /**
     * @ORM\ManyToOne(targetEntity=UtilisateurProfil::class, inversedBy="utilisateurAffectations")
     * @ORM\JoinColumn(name="idutilisateur_profil")
     * @Ignore()
     */
    private $utilisateur_profil;

    /**
     * @ORM\ManyToOne(targetEntity=Utilisateur::class, inversedBy="utilisateur_affectations_planning")
     * @ORM\JoinColumn(name="idutilisateur_planning")
     * @Ignore()
     */
    private $utilisateur_planning;

    /**
     * @ORM\ManyToOne(targetEntity=Utilisateur::class, inversedBy="utilisateur_affectations_responsable")
     * @ORM\JoinColumn(name="idutilisateur_responsable")
     * @Ignore()
     */
    private $utilisateur_reponsable;

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

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

    /**
     * @ORM\Column(type="string", length=4, nullable=true)
     */
    private $service;

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

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

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

    /**
     * @ORM\ManyToOne(targetEntity=Utilisateur::class, inversedBy="utilisateur_affectations_binome")
     * @ORM\JoinColumn(name="idutilisateur_binome")
     */
    private $utilisateur_binome;

    /**
     * @ORM\ManyToOne(targetEntity=MotifTempsPartiel::class, inversedBy="utilisateurAffectations")
     * @ORM\JoinColumn(name="idmotif_temps_partiel")
     */
    private $motif_temps_partiel;

    /**
     * @ORM\Column(type="string", length=4, nullable=true)
     */
    private $numero;

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

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

    public function getUtilisateur(): ?Utilisateur
    {
        return $this->utilisateur;
    }

    public function setUtilisateur(?Utilisateur $utilisateur): self
    {
        $this->utilisateur = $utilisateur;

        return $this;
    }

    public function getUtilisateurProfil(): ?UtilisateurProfil
    {
        return $this->utilisateur_profil;
    }

    public function setUtilisateurProfil(?UtilisateurProfil $utilisateur_profil): self
    {
        $this->utilisateur_profil = $utilisateur_profil;

        return $this;
    }

    public function getUtilisateurPlanning(): ?Utilisateur
    {
        return $this->utilisateur_planning;
    }

    /**
     * @Ignore()
     */
    public function getUtilisateurPlanningIdNom() {
        if ($this->utilisateur_planning) {
            return $this->utilisateur_planning->getId() . ' - ' .$this->utilisateur_planning->getNomComplet();
        }
        return '';
    }

    public function setUtilisateurPlanning(?Utilisateur $utilisateur_planning): self
    {
        $this->utilisateur_planning = $utilisateur_planning;

        return $this;
    }

    public function getUtilisateurReponsable(): ?Utilisateur
    {
        return $this->utilisateur_reponsable;
    }

    public function setUtilisateurReponsable(?Utilisateur $utilisateur_reponsable): self
    {
        $this->utilisateur_reponsable = $utilisateur_reponsable;

        return $this;
    }

    public function getDebutEffet(): ?\DateTimeInterface
    {
        return $this->debut_effet;
    }

    public function setDebutEffet(?\DateTimeInterface $debut_effet): self
    {
        $this->debut_effet = $debut_effet;

        return $this;
    }

    public function getFinEffet(): ?\DateTimeInterface
    {
        return $this->fin_effet;
    }

    public function setFinEffet(?\DateTimeInterface $fin_effet): self
    {
        $this->fin_effet = $fin_effet;

        return $this;
    }

    public function getService(): ?string
    {
        return $this->service;
    }

    public function setService(?string $service): self
    {
        $this->service = $service;

        return $this;
    }

    public function getEstResponsable(): ?bool
    {
        return $this->est_responsable;
    }

    public function setEstResponsable(?bool $est_responsable): self
    {
        $this->est_responsable = $est_responsable;

        return $this;
    }

    public function getPlanifiable(): ?bool
    {
        return $this->planifiable;
    }

    public function setPlanifiable(?bool $planifiable): self
    {
        $this->planifiable = $planifiable;

        return $this;
    }

    public function getTempsTravail(): ?int
    {
        return $this->temps_travail;
    }

    public function setTempsTravail(?int $temps_travail): self
    {
        $this->temps_travail = $temps_travail;

        return $this;
    }

    public function getUtilisateurBinome(): ?Utilisateur
    {
        return $this->utilisateur_binome;
    }

    public function setUtilisateurBinome(?Utilisateur $utilisateur_binome): self
    {
        $this->utilisateur_binome = $utilisateur_binome;

        return $this;
    }

    public function getMotifTempsPartiel(): ?MotifTempsPartiel
    {
        return $this->motif_temps_partiel;
    }

    public function setMotifTempsPartiel(?MotifTempsPartiel $motif_temps_partiel): self
    {
        $this->motif_temps_partiel = $motif_temps_partiel;

        return $this;
    }

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

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

        return $this;
    }

    public function getNumero(): ?string
    {
        return $this->numero;
    }

    public function setNumero(?string $numero): self
    {
        $this->numero = $numero;

        return $this;
    }
}
