<?php

namespace AppBundle\Entity\Billing;

use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM;
use Dunglas\ApiBundle\Annotation\Iri;
use Symfony\Component\Serializer\Annotation\Groups;
use Symfony\Component\Validator\Constraints as Assert;
use AppBundle\Entity\Traits\TimestampableEntity;
use AppBundle\Entity\Traits\CreatorUpdaterEntity;

/**
 * Trop-perçu conservé pour être reversé à la Bill suivante
 *
 * @Iri("http://schema.org/BillDebitBalance")
 */
#[ORM\Entity]
class BillDebitBalance
{
    use TimestampableEntity;
    use CreatorUpdaterEntity;
    /**
     * @var int
     */
    #[ORM\Column(type: 'integer')]
    #[ORM\Id]
    #[ORM\GeneratedValue(strategy: 'AUTO')]
    #[Groups(['billdebitbalance'])]
    private $id;
    /**
     * @var BillingSetting
     */
    #[ORM\ManyToOne(targetEntity: 'AppBundle\Entity\Billing\AccessBilling', inversedBy: 'billDebitBalances')]
    #[ORM\JoinColumn(nullable: false)]
    #[Assert\NotNull]
    #[Groups(['billdebitbalance'])]
    private $accessBilling;
    /**
     *
     * @var BillPayment
     */
    #[ORM\ManyToOne(targetEntity: 'AppBundle\Entity\Billing\BillPayment', inversedBy: 'billDebitBalances', cascade: ['persist'])]
    #[ORM\JoinColumn(nullable: false)]
    #[Assert\NotNull]
    #[Groups(['billdebitbalance'])]
    private $billPayment;
    /**
     * @var float
     */
    #[ORM\Column(type: 'float', nullable: true)]
    #[Assert\Type(type: 'float')]
    #[Groups(['billdebitbalance'])]
    private $amount;
    /**
     * @var bool
     */
    #[ORM\Column(type: 'boolean', options: ['default' => false])]
    #[Assert\Type(type: 'boolean')]
    #[Assert\NotNull]
    #[Groups(['billdebitbalance'])]
    private $isUsed = false;
    /**
     * Constructor
     */
    public function __construct()
    {
        $this->accessBilling = new ArrayCollection();
    }
    /**
     * Sets id.
     *
     * @param int $id
     *
     * @return $this
     */
    public function setId($id)
    {
        $this->id = $id;

        return $this;
    }
    /**
     * Gets id.
     *
     * @return int
     */
    public function getId()
    {
        return $this->id;
    }
    /**
     * Set amount
     *
     * @param float $amount
     *
     * @return BillDebitBalance
     */
    public function setAmount($amount)
    {
        $this->amount = $amount;

        return $this;
    }
    /**
     * Get amount
     *
     * @return float
     */
    public function getAmount()
    {
        return $this->amount;
    }
    /**
     * Set accessBilling
     *
     * @param \AppBundle\Entity\Billing\AccessBilling $accessBilling
     *
     * @return BillDebitBalance
     */
    public function setAccessBilling(\AppBundle\Entity\Billing\AccessBilling $accessBilling)
    {
        $this->accessBilling = $accessBilling;

        return $this;
    }
    /**
     * Get accessBilling
     *
     * @return \AppBundle\Entity\Billing\AccessBilling
     */
    public function getAccessBilling()
    {
        return $this->accessBilling;
    }
    /**
     * Set billPayment
     *
     * @param \AppBundle\Entity\Billing\BillPayment $billPayment
     *
     * @return BillDebitBalance
     */
    public function setBillPayment(\AppBundle\Entity\Billing\BillPayment $billPayment)
    {
        $this->billPayment = $billPayment;

        return $this;
    }
    /**
     * Get billPayment
     *
     * @return \AppBundle\Entity\Billing\BillPayment
     */
    public function getBillPayment()
    {
        return $this->billPayment;
    }
    /**
     * Set isUsed
     *
     * @param boolean $isUsed
     *
     * @return BillDebitBalance
     */
    public function setIsUsed($isUsed)
    {
        $this->isUsed = $isUsed;

        return $this;
    }
    /**
     * Get isUsed
     *
     * @return boolean
     */
    public function getIsUsed()
    {
        return $this->isUsed;
    }
}
