<?php

namespace App\Entity;

use App\Repository\PaiementRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;

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

    /**
     * @ORM\ManyToOne(targetEntity=Facture::class, inversedBy="paiements")
     * @ORM\JoinColumn(name="idfacture",nullable=false)
     */
    private $facture;

    /**
     * @ORM\ManyToOne(targetEntity=MoyenPaiement::class, inversedBy="paiements")
     * @ORM\JoinColumn(name="idmoyen_paiement",nullable=false)
     */
    private $moyen_paiement;

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

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

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

    public function __construct()
    {
        $this->moyen_paiement = new ArrayCollection();
    }

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

    public function getFacture(): ?Facture
    {
        return $this->facture;
    }

    public function setFacture(?Facture $facture): self
    {
        $this->facture = $facture;

        return $this;
    }

    /**
     * @return Collection<int, MoyenPaiement>
     */
    public function getMoyenPaiement()
    {
        return $this->moyen_paiement;
    }

    public function addMoyenPaiement(MoyenPaiement $moyenPaiement): self
    {
        if (!$this->moyen_paiement->contains($moyenPaiement)) {
            $this->moyen_paiement[] = $moyenPaiement;
        }

        return $this;
    }

    public function removeMoyenPaiement(MoyenPaiement $moyenPaiement): self
    {
        $this->moyen_paiement->removeElement($moyenPaiement);

        return $this;
    }

    public function getMontantTtc(): ?float
    {
        return $this->montant_ttc;
    }

    public function setMontantTtc(?float $montant_ttc): self
    {
        $this->montant_ttc = $montant_ttc;

        return $this;
    }

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

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

        return $this;
    }

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

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

        return $this;
    }
}
