<?php

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

use JsonSerializable;
use Northmill_Online_Shared_Checkout\Northmill_Online_Shared\Helpers\General_Helpers;
/**
 * Class Voucher_Row_Model
 */
class Receipt_Voucher_Row_Model implements JsonSerializable
{
    /**
     * Bookkeeping account number for the row.
     *
     * @var int
     */
    protected int $AccountNumber;
    /**
     * Debit amount for the row.
     *
     * @var string
     */
    protected string $DebitAmount;
    /**
     * Credit amount for the row.
     *
     * @var string
     */
    protected string $CreditAmount;
    /**
     * Optional description for the account.
     *
     * @var string|null
     */
    protected ?string $AccountDescription;
    /**
     * Optional transaction text.
     *
     * @var string|null
     */
    protected ?string $TransactionText;
    /**
     * Optional project.
     *
     * @var string|null
     */
    protected ?string $Project;
    /**
     * Optional cost center.
     *
     * @var string|null
     */
    protected ?string $CostCenter;
    /**
     * Whether the row is deleted.
     *
     * @var bool
     */
    protected ?bool $IsDeleted;
    /**
     * Optional time the row was created.
     *
     * @var string|null
     */
    protected ?string $CreatedTime;
    /**
     * Optional time the row was modified.
     *
     * @var string|null
     */
    protected ?string $ModifiedTime;
    public function __construct(int $account_number, float|string $debit_amount, float|string $credit_amount, string $account_description = null, string $transaction_text = null, string $project = null, string $cost_center = null, bool $is_deleted = null, string $created_time = null, string $modified_time = null)
    {
        $this->AccountNumber = $account_number;
        $this->DebitAmount = General_Helpers::round_and_format_number($debit_amount);
        $this->CreditAmount = General_Helpers::round_and_format_number($credit_amount);
        $this->AccountDescription = $account_description;
        $this->TransactionText = $transaction_text;
        $this->Project = $project;
        $this->CostCenter = $cost_center;
        $this->IsDeleted = $is_deleted;
        $this->CreatedTime = $created_time;
        $this->ModifiedTime = $modified_time;
    }
    /**
     * Get the float value of the credit amount.
     *
     * @return float
     */
    public function get_credit_amount_float(): float
    {
        return floatval($this->CreditAmount);
    }
    /**
     * Get the float value of the debit amount.
     *
     * @return float
     */
    public function get_debit_amount_float(): float
    {
        return floatval($this->DebitAmount);
    }
    public function jsonSerialize(): array
    {
        return array('AccountNumber' => $this->AccountNumber, 'DebitAmount' => $this->DebitAmount, 'CreditAmount' => $this->CreditAmount, 'AccountDescription' => $this->AccountDescription, 'TransactionText' => $this->TransactionText, 'Project' => $this->Project, 'CostCenter' => $this->CostCenter, 'IsDeleted' => $this->IsDeleted, 'CreatedTime' => $this->CreatedTime, 'ModifiedTime' => $this->ModifiedTime);
    }
}
