<?php

namespace App\Classes\Modules\Transactions\DataTransferObjects;

use App\Classes\General\Interfaces\DataTransferObject;

class TransactionDetailObject implements DataTransferObject
{
    /** @var string|null */
    private $reference;

    /** @var string|null */
    private $name;

    /** @var int|null */
    private $quantity;

    /** @var float|null */
    private $price;

    /**
     * TransactionDetailObject constructor.
     * @param string $reference
     * @param string $name
     * @param int $quantity
     * @param float $price
     */
    public function __construct(?string $reference, ?string $name , ?int $quantity, ?float $price)
    {
        $this->reference = $reference;
        $this->name = $name;
        $this->quantity = $quantity;
        $this->price = $price;
    }

    /**
     * @return string
     */
    public function getReference(): ?string
    {
        return $this->reference;
    }

    /**
     * @return string
     */
    public function getName(): ?string
    {
        return $this->name;
    }

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

    /**
     * @return float
     */
    public function getPrice(): ?float
    {
        return $this->price;
    }

    public function getAmount(): float
    {
        return $this->getQuantity() * $this->getPrice();
    }

}
