<?php

namespace App\Entity;

use App\Repository\BilletBuyerItemRepository;
use Doctrine\ORM\Mapping as ORM;

#[ORM\Entity(repositoryClass: BilletBuyerItemRepository::class)]
class BilletBuyerItem
{
    #[ORM\Id]
    #[ORM\GeneratedValue]
    #[ORM\Column]
    private ?int $id = null;

    #[ORM\ManyToOne(targetEntity: BilletBuyer::class, inversedBy: 'items')]
    #[ORM\JoinColumn(nullable: false, onDelete: 'CASCADE')]
    private ?BilletBuyer $billetBuyer = null;

    #[ORM\ManyToOne(targetEntity: Billet::class)]
    #[ORM\JoinColumn(nullable: false)]
    private ?Billet $billet = null;

    #[ORM\Column]
    private int $quantity = 1;

    #[ORM\Column]
    private int $unitPriceHT = 0;

    #[ORM\Column(length: 255)]
    private ?string $billetName = null;

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

    public function getBilletBuyer(): ?BilletBuyer
    {
        return $this->billetBuyer;
    }

    public function setBilletBuyer(?BilletBuyer $billetBuyer): static
    {
        $this->billetBuyer = $billetBuyer;

        return $this;
    }

    public function getBillet(): ?Billet
    {
        return $this->billet;
    }

    public function setBillet(?Billet $billet): static
    {
        $this->billet = $billet;

        return $this;
    }

    public function getQuantity(): int
    {
        return $this->quantity;
    }

    public function setQuantity(int $quantity): static
    {
        $this->quantity = $quantity;

        return $this;
    }

    public function getUnitPriceHT(): int
    {
        return $this->unitPriceHT;
    }

    public function setUnitPriceHT(int $unitPriceHT): static
    {
        $this->unitPriceHT = $unitPriceHT;

        return $this;
    }

    public function getUnitPriceHTDecimal(): float
    {
        return $this->unitPriceHT / 100;
    }

    public function getLineTotalHT(): int
    {
        return $this->unitPriceHT * $this->quantity;
    }

    public function getLineTotalHTDecimal(): float
    {
        return $this->getLineTotalHT() / 100;
    }

    public function getBilletName(): ?string
    {
        return $this->billetName;
    }

    public function setBilletName(string $billetName): static
    {
        $this->billetName = $billetName;

        return $this;
    }
}
