<?php

namespace App\Entity;

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

/**
 * @ORM\Entity(repositoryClass=MoyenPaiementRepository::class)
 * @ORM\Table(schema="sav")
 */
class MoyenPaiement
{
    /**
     * @ORM\Id
     * @ORM\GeneratedValue
     * @ORM\Column(type="integer")
     * @Groups({"api"})
     */
    private $id;

    /**
     * @ORM\Column(type="string", length=3, nullable=true)
     * @Groups({"api"})
     */
    private $libelle_court;

    /**
     * @ORM\Column(type="string", length=30, nullable=true)
     * @Groups({"api"})
     */
    private $libelle_long;

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

    /**
     * @ORM\OneToMany(targetEntity=Paiement::class, mappedBy="moyen_paiement")
     * @Ignore()
     */
    private $paiements;

    public function __construct()
    {
        $this->paiements = 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 getAffichageTablette(): ?bool
    {
        return $this->affichage_tablette;
    }

    public function setAffichageTablette(?bool $affichage_tablette): self
    {
        $this->affichage_tablette = $affichage_tablette;

        return $this;
    }

    /**
     * @return Collection<int, Paiement>
     */
    public function getPaiements(): Collection
    {
        return $this->paiements;
    }

    public function addPaiement(Paiement $paiement): self
    {
        if (!$this->paiements->contains($paiement)) {
            $this->paiements[] = $paiement;
            $paiement->addMoyenPaiement($this);
        }

        return $this;
    }

    public function removePaiement(Paiement $paiement): self
    {
        if ($this->paiements->removeElement($paiement)) {
            $paiement->removeMoyenPaiement($this);
        }

        return $this;
    }
}
