<?php

namespace AppBundle\Entity\Billing;

use AppBundle\Entity\AccessAndFunction\Access;
use AppBundle\Entity\Booking\EducationalProject;
use AppBundle\Entity\Product\EquipmentLoan;
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;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;

/**
 * Une ligne de facturation
 * @see BillAccounting
 *
 * @Iri("http://schema.org/BillLine")
 */
#[ORM\Entity]
class BillLine
{
    use TimestampableEntity;
    use CreatorUpdaterEntity;
    /**
     * @var int
     */
    #[ORM\Column(type: 'integer')]
    #[ORM\Id]
    #[ORM\GeneratedValue(strategy: 'AUTO')]
    #[Groups(['billline', 'billaccounting_list', 'bill_list', 'build_bills'])]
    private $id;
    /**
     * @var Bill
     */
    #[ORM\ManyToOne(targetEntity: 'AppBundle\Entity\Billing\BillAccounting', inversedBy: 'billLines')]
    #[ORM\JoinColumn(nullable: false)]
    #[Assert\NotNull]
    #[Groups(['billline'])]
    private $bill;
    /**
     * @var Access
     */
    #[ORM\ManyToOne(targetEntity: 'AppBundle\Entity\AccessAndFunction\Access', inversedBy: 'billLines')]
    #[Groups(['billline', 'billaccounting_list_billlines', 'bill_list_billlines', 'billpayment_list_bill', 'billaccounting_list_bill', 'billcredit_list_bill', 'build_bills_billlines'])]
    private $access;
    /**
     * @var EducationalProject
     */
    #[ORM\ManyToOne(targetEntity: 'AppBundle\Entity\Booking\EducationalProject', inversedBy: 'billLines')]
    #[Groups(['billline', 'build_bills_billlines'])]
    private $educationalProject;
    /**
     * @var EquipmentLoan
     */
    #[ORM\ManyToOne(targetEntity: 'AppBundle\Entity\Product\EquipmentLoan', inversedBy: 'billLines')]
    #[Groups(['billline'])]
    private $equipmentLoan;
    /**
     * @var string
     */
    #[ORM\Column(type: 'text', nullable: true)]
    #[Assert\Type(type: 'string')]
    #[Groups(['billline', 'build_bills_billlines'])]
    private $intangibleName;
    /**
     * @var string
     *
     * @Iri("https://schema.org/description")
     */
    #[ORM\Column(type: 'text', nullable: true)]
    #[Assert\Type(type: 'string')]
    #[Groups(['billline', 'build_bills_billlines'])]
    private $intangibleDescription;
    /**
     * @var string
     */
    #[ORM\Column(type: 'text', nullable: true)]
    #[Assert\Type(type: 'string')]
    #[Groups(['billline'])]
    private $intangibleDomain;
    /**
     * @var int
     */
    #[ORM\Column(type: 'integer', nullable: true)]
    #[Assert\Type(type: 'integer', message: 'invalid-integer')]
    #[Groups(['billline', 'build_bills_billlines'])]
    private $quantity;
    /**
     * @var float
     */
    #[ORM\Column(type: 'float', nullable: true)]
    #[Assert\Type(type: 'float')]
    #[Groups(['billline', 'build_bills_billlines'])]
    private $unitPrice;
    /**
     * @var float
     */
    #[ORM\Column(type: 'float', nullable: true)]
    #[Assert\Type(type: 'float')]
    #[Groups(['billline', 'build_bills_billlines'])]
    private $vat;
    /**
     * @var float
     */
    #[ORM\Column(type: 'float', nullable: true)]
    #[Assert\Type(type: 'float')]
    #[Groups(['billline', 'build_bills_billlines'])]
    private $totalPrice;
    /**
     * @var array
     */
    #[ORM\Column(type: 'json_array', nullable: true)]
    #[Groups(['billline', 'build_bills_billlines'])]
    private $reductions;
    /**
     * @var int
     */
    #[ORM\Column(type: 'integer', nullable: true)]
    #[Assert\Type(type: 'integer', message: 'invalid-integer')]
    #[Groups(['billline', 'build_bills_billlines'])]
    private $accountingCode;
    /**
     * @var string
     */
    #[ORM\Column(type: 'string', length: 200, nullable: true)]
    #[Assert\Type(type: 'string')]
    #[Groups(['billline', 'build_bills_billlines'])]
    private $accountingCodelabel;
    /**
     * @var int
     */
    #[ORM\Column(type: 'integer', nullable: true)]
    #[Assert\Type(type: 'integer', message: 'invalid-integer')]
    #[Groups(['billline', 'build_bills_billlines'])]
    private $nature;
    /**
     * @var array
     */
    #[ORM\Column(type: 'json_array', nullable: true)]
    #[Groups(['billline'])]
    private $educations;
    /**
     * @var bool
     */
    #[ORM\Column(type: 'boolean', options: ['default' => true])]
    #[Assert\Type(type: 'boolean')]
    #[Assert\NotNull]
    #[Groups(['billline', 'build_bills_billlines'])]
    private $showInBill = true;
    /**
     * Constructor
     */
    public function __construct()
    {
    }
    /**
     * 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 intangibleName
     *
     * @param string $intangibleName
     *
     * @return BillLine
     */
    public function setIntangibleName($intangibleName)
    {
        $this->intangibleName = $intangibleName;

        return $this;
    }
    /**
     * Get intangibleName
     *
     * @return string
     */
    public function getIntangibleName()
    {
        return $this->intangibleName;
    }
    /**
     * Set intangibleDescription
     *
     * @param string $intangibleDescription
     *
     * @return BillLine
     */
    public function setIntangibleDescription($intangibleDescription)
    {
        $this->intangibleDescription = $intangibleDescription;

        return $this;
    }
    /**
     * Get intangibleDescription
     *
     * @return string
     */
    public function getIntangibleDescription()
    {
        return $this->intangibleDescription;
    }
    /**
     * Set quantity
     *
     * @param integer $quantity
     *
     * @return BillLine
     */
    public function setQuantity($quantity)
    {
        $this->quantity = $quantity;

        return $this;
    }
    /**
     * Get quantity
     *
     * @return integer
     */
    public function getQuantity()
    {
        return $this->quantity;
    }
    /**
     * Set unitPrice
     *
     * @param float $unitPrice
     *
     * @return BillLine
     */
    public function setUnitPrice($unitPrice)
    {
        $this->unitPrice = floatval($unitPrice);

        return $this;
    }
    /**
     * Get unitPrice
     *
     * @return float
     */
    public function getUnitPrice()
    {
        return $this->unitPrice;
    }
    /**
     * Set bill
     *
     * @param $bill
     *
     * @return BillLine
     */
    public function setBill($bill)
    {
        $this->bill = $bill;

        return $this;
    }
    /**
     * Get bill
     *
     * @return
     */
    public function getBill()
    {
        return $this->bill;
    }
    /**
     * Set access
     *
     * @param \AppBundle\Entity\AccessAndFunction\Access $access
     *
     * @return BillLine
     */
    public function setAccess(\AppBundle\Entity\AccessAndFunction\Access $access)
    {
        $this->access = $access;

        return $this;
    }
    /**
     * Get access
     *
     * @return \AppBundle\Entity\AccessAndFunction\Access
     */
    public function getAccess()
    {
        return $this->access;
    }
    /**
     * Set vat
     *
     * @param float $vat
     *
     * @return BillLine
     */
    public function setVat($vat)
    {
        $this->vat = floatval($vat);

        return $this;
    }
    /**
     * Get vat
     *
     * @return float
     */
    public function getVat()
    {
        return $this->vat;
    }
    /**
     * Set totalPrice
     *
     * @param float $totalPrice
     *
     * @return BillLine
     */
    public function setTotalPrice($totalPrice)
    {
        $this->totalPrice = floatval($totalPrice);

        return $this;
    }
    /**
     * Get totalPrice
     *
     * @return float
     */
    public function getTotalPrice()
    {
        return $this->totalPrice;
    }
    /**
     * Set reductions
     *
     * @param array $reductions
     *
     * @return BillLine
     */
    public function setReductions($reductions)
    {
        $this->reductions = $reductions;

        return $this;
    }
    /**
     * Get reductions
     *
     * @return array
     */
    public function getReductions()
    {
        return $this->reductions;
    }
    /**
     * Set accountingCode
     *
     * @param integer $accountingCode
     *
     * @return BillLine
     */
    public function setAccountingCode($accountingCode)
    {
        $this->accountingCode = $accountingCode;

        return $this;
    }
    /**
     * Get accountingCode
     *
     * @return integer
     */
    public function getAccountingCode()
    {
        return $this->accountingCode;
    }
    /**
     * Set nature
     *
     * @param integer $nature
     *
     * @return BillLine
     */
    public function setNature($nature)
    {
        $this->nature = $nature;

        return $this;
    }
    /**
     * Get nature
     *
     * @return integer
     */
    public function getNature()
    {
        return $this->nature;
    }
    /**
     * Set educationalProject
     *
     * @param \AppBundle\Entity\Booking\EducationalProject $educationalProject
     *
     * @return BillLine
     */
    public function setEducationalProject(\AppBundle\Entity\Booking\EducationalProject $educationalProject = null)
    {
        $this->educationalProject = $educationalProject;

        return $this;
    }
    /**
     * Get educationalProject
     *
     * @return \AppBundle\Entity\Booking\EducationalProject
     */
    public function getEducationalProject()
    {
        return $this->educationalProject;
    }
    /**
     * Set equipmentLoan
     *
     * @param \AppBundle\Entity\Product\EquipmentLoan $equipmentLoan
     *
     * @return BillLine
     */
    public function setEquipmentLoan(\AppBundle\Entity\Product\EquipmentLoan $equipmentLoan = null)
    {
        $this->equipmentLoan = $equipmentLoan;

        return $this;
    }
    /**
     * Get equipmentLoan
     *
     * @return \AppBundle\Entity\Product\EquipmentLoan
     */
    public function getEquipmentLoan()
    {
        return $this->equipmentLoan;
    }
    /**
     * Set educations
     *
     * @param array $educations
     *
     * @return BillLine
     */
    public function setEducations($educations)
    {
        $this->educations = $educations;

        return $this;
    }
    /**
     * Get educations
     *
     * @return array
     */
    public function getEducations()
    {
        return $this->educations;
    }
    /**
     * Set accountingCodelabel
     *
     * @param string $accountingCodelabel
     *
     * @return BillLine
     */
    public function setAccountingCodelabel($accountingCodelabel)
    {
        $this->accountingCodelabel = $accountingCodelabel;

        return $this;
    }
    /**
     * Get accountingCodelabel
     *
     * @return string
     */
    public function getAccountingCodelabel()
    {
        return $this->accountingCodelabel;
    }
    /**
     * Set intangibleDomain
     *
     * @param string $intangibleDomain
     *
     * @return BillLine
     */
    public function setIntangibleDomain($intangibleDomain)
    {
        $this->intangibleDomain = $intangibleDomain;

        return $this;
    }
    /**
     * Get intangibleDomain
     *
     * @return string
     */
    public function getIntangibleDomain()
    {
        return $this->intangibleDomain;
    }
    /**
     * Set showInBill
     *
     * @param boolean $showInBill
     *
     * @return BillLine
     */
    public function setShowInBill($showInBill)
    {
        $this->showInBill = $showInBill;

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