<?php

/**
 * Receipt VAT model.
 *
 * @package northmill-online-shared
 */
declare (strict_types=1);
namespace Northmill_Online_Shared_Sync\Northmill_Online_Shared\Abstracts\Hub_API\Models\Receipts;

use JsonSerializable;
use Northmill_Online_Shared_Sync\Northmill_Online_Shared\Helpers\General_Helpers;
/**
 * Class Vat_Model
 */
class Receipt_Vat_Model implements JsonSerializable
{
    /**
     * VAT rate in percent.
     *
     * @var float
     */
    protected float $VatRate;
    /**
     * Total VAT amount.
     *
     * @var string
     */
    protected string $TotalVat;
    /**
     * Total amount for tax item including VAT.
     *
     * @var string
     */
    protected string $TotalAmount;
    /**
     * Bookkeeping account number for the VAT.
     *
     * @var int|null
     */
    protected ?int $BookkeepingAccount;
    public function __construct(float $vat_rate, float|string $total_vat, float|string $total_amount, ?int $bookkeeping_account)
    {
        $this->VatRate = $vat_rate;
        $this->TotalVat = General_Helpers::round_and_format_number($total_vat);
        $this->TotalAmount = General_Helpers::round_and_format_number($total_amount);
        $this->BookkeepingAccount = $bookkeeping_account;
    }
    public function get_total_vat(): string
    {
        return $this->TotalVat;
    }
    public function get_bookkeeping_account(): ?int
    {
        return $this->BookkeepingAccount;
    }
    public function jsonSerialize(): array
    {
        return array('VatRate' => $this->VatRate, 'TotalVat' => $this->TotalVat, 'TotalAmount' => $this->TotalAmount);
    }
}
