<?php

/**
 * WithdrawHistoryV2ResponseInner.
 *
 * PHP version 8.1
 *
 * @category Class
 *
 * @author   OpenAPI Generator team
 *
 * @see     https://openapi-generator.tech
 */

/**
 * Binance Wallet REST API.
 *
 * OpenAPI Specification for the Binance Wallet REST API
 *
 * The version of the OpenAPI document: 1.0.0
 * Generated by: https://openapi-generator.tech
 * Generator version: 7.12.0
 */

/**
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 * https://openapi-generator.tech
 * Do not edit the class manually.
 */

namespace Binance\Client\Wallet\Model;

use Binance\Common\Dtos\ModelInterface;
use Binance\Common\ObjectSerializer;

/**
 * WithdrawHistoryV2ResponseInner Class Doc Comment.
 *
 * @category Class
 *
 * @author   OpenAPI Generator team
 *
 * @see     https://openapi-generator.tech
 *
 * @implements \ArrayAccess<string, mixed>
 */
class WithdrawHistoryV2ResponseInner implements ModelInterface, \ArrayAccess, \JsonSerializable
{
    public const DISCRIMINATOR = null;

    /**
     * The original name of the model.
     *
     * @var string
     */
    protected static $openAPIModelName = 'withdrawHistoryV2Response_inner';

    /**
     * Array of property to type mappings. Used for (de)serialization.
     *
     * @var string[]
     */
    protected static $openAPITypes = [
        'id' => 'string',
        'trId' => 'int',
        'amount' => 'string',
        'transactionFee' => 'string',
        'coin' => 'string',
        'withdrawalStatus' => 'int',
        'travelRuleStatus' => 'int',
        'address' => 'string',
        'addressTag' => 'string',
        'txId' => 'string',
        'applyTime' => 'string',
        'network' => 'string',
        'transferType' => 'int',
        'withdrawOrderId' => 'string',
        'info' => 'string',
        'confirmNo' => 'int',
        'walletType' => 'int',
        'txKey' => 'string',
        'questionnaire' => 'string',
        'completeTime' => 'string',
    ];

    /**
     * Array of property to format mappings. Used for (de)serialization.
     *
     * @var string[]
     *
     * @phpstan-var array<string, string|null>
     *
     * @psalm-var array<string, string|null>
     */
    protected static $openAPIFormats = [
        'id' => null,
        'trId' => 'int64',
        'amount' => null,
        'transactionFee' => null,
        'coin' => null,
        'withdrawalStatus' => 'int64',
        'travelRuleStatus' => 'int64',
        'address' => null,
        'addressTag' => null,
        'txId' => null,
        'applyTime' => null,
        'network' => null,
        'transferType' => 'int64',
        'withdrawOrderId' => null,
        'info' => null,
        'confirmNo' => 'int64',
        'walletType' => 'int64',
        'txKey' => null,
        'questionnaire' => null,
        'completeTime' => null,
    ];

    /**
     * Array of nullable properties. Used for (de)serialization.
     *
     * @var bool[]
     */
    protected static array $openAPINullables = [
        'id' => false,
        'trId' => false,
        'amount' => false,
        'transactionFee' => false,
        'coin' => false,
        'withdrawalStatus' => false,
        'travelRuleStatus' => false,
        'address' => false,
        'addressTag' => false,
        'txId' => false,
        'applyTime' => false,
        'network' => false,
        'transferType' => false,
        'withdrawOrderId' => false,
        'info' => false,
        'confirmNo' => false,
        'walletType' => false,
        'txKey' => false,
        'questionnaire' => false,
        'completeTime' => false,
    ];

    /**
     * If a nullable field gets set to null, insert it here.
     *
     * @var bool[]
     */
    protected array $openAPINullablesSetToNull = [];

    /**
     * Array of attributes where the key is the local name,
     * and the value is the original name.
     *
     * @var string[]
     */
    protected static $attributeMap = [
        'id' => 'id',
        'trId' => 'trId',
        'amount' => 'amount',
        'transactionFee' => 'transactionFee',
        'coin' => 'coin',
        'withdrawalStatus' => 'withdrawalStatus',
        'travelRuleStatus' => 'travelRuleStatus',
        'address' => 'address',
        'addressTag' => 'addressTag',
        'txId' => 'txId',
        'applyTime' => 'applyTime',
        'network' => 'network',
        'transferType' => 'transferType',
        'withdrawOrderId' => 'withdrawOrderId',
        'info' => 'info',
        'confirmNo' => 'confirmNo',
        'walletType' => 'walletType',
        'txKey' => 'txKey',
        'questionnaire' => 'questionnaire',
        'completeTime' => 'completeTime',
    ];

    /**
     * Array of attributes to setter functions (for deserialization of responses).
     *
     * @var string[]
     */
    protected static $setters = [
        'id' => 'setId',
        'trId' => 'setTrId',
        'amount' => 'setAmount',
        'transactionFee' => 'setTransactionFee',
        'coin' => 'setCoin',
        'withdrawalStatus' => 'setWithdrawalStatus',
        'travelRuleStatus' => 'setTravelRuleStatus',
        'address' => 'setAddress',
        'addressTag' => 'setAddressTag',
        'txId' => 'setTxId',
        'applyTime' => 'setApplyTime',
        'network' => 'setNetwork',
        'transferType' => 'setTransferType',
        'withdrawOrderId' => 'setWithdrawOrderId',
        'info' => 'setInfo',
        'confirmNo' => 'setConfirmNo',
        'walletType' => 'setWalletType',
        'txKey' => 'setTxKey',
        'questionnaire' => 'setQuestionnaire',
        'completeTime' => 'setCompleteTime',
    ];

    /**
     * Array of attributes to getter functions (for serialization of requests).
     *
     * @var string[]
     */
    protected static $getters = [
        'id' => 'getId',
        'trId' => 'getTrId',
        'amount' => 'getAmount',
        'transactionFee' => 'getTransactionFee',
        'coin' => 'getCoin',
        'withdrawalStatus' => 'getWithdrawalStatus',
        'travelRuleStatus' => 'getTravelRuleStatus',
        'address' => 'getAddress',
        'addressTag' => 'getAddressTag',
        'txId' => 'getTxId',
        'applyTime' => 'getApplyTime',
        'network' => 'getNetwork',
        'transferType' => 'getTransferType',
        'withdrawOrderId' => 'getWithdrawOrderId',
        'info' => 'getInfo',
        'confirmNo' => 'getConfirmNo',
        'walletType' => 'getWalletType',
        'txKey' => 'getTxKey',
        'questionnaire' => 'getQuestionnaire',
        'completeTime' => 'getCompleteTime',
    ];

    /**
     * Associative array for storing property values.
     *
     * @var mixed[]
     */
    protected $container = [];

    /**
     * Constructor.
     *
     * @param null|mixed[] $data Associated array of property values
     *                           initializing the model
     */
    public function __construct(?array $data = null)
    {
        $this->setIfExists('id', $data ?? [], null);
        $this->setIfExists('trId', $data ?? [], null);
        $this->setIfExists('amount', $data ?? [], null);
        $this->setIfExists('transactionFee', $data ?? [], null);
        $this->setIfExists('coin', $data ?? [], null);
        $this->setIfExists('withdrawalStatus', $data ?? [], null);
        $this->setIfExists('travelRuleStatus', $data ?? [], null);
        $this->setIfExists('address', $data ?? [], null);
        $this->setIfExists('addressTag', $data ?? [], null);
        $this->setIfExists('txId', $data ?? [], null);
        $this->setIfExists('applyTime', $data ?? [], null);
        $this->setIfExists('network', $data ?? [], null);
        $this->setIfExists('transferType', $data ?? [], null);
        $this->setIfExists('withdrawOrderId', $data ?? [], null);
        $this->setIfExists('info', $data ?? [], null);
        $this->setIfExists('confirmNo', $data ?? [], null);
        $this->setIfExists('walletType', $data ?? [], null);
        $this->setIfExists('txKey', $data ?? [], null);
        $this->setIfExists('questionnaire', $data ?? [], null);
        $this->setIfExists('completeTime', $data ?? [], null);
    }

    /**
     * Gets the string presentation of the object.
     *
     * @return string
     */
    public function __toString()
    {
        return json_encode(
            ObjectSerializer::sanitizeForSerialization($this),
            JSON_PRETTY_PRINT
        );
    }

    /**
     * Array of property to type mappings. Used for (de)serialization.
     *
     * @return array
     */
    public static function openAPITypes()
    {
        return self::$openAPITypes;
    }

    /**
     * Array of property to format mappings. Used for (de)serialization.
     *
     * @return array
     */
    public static function openAPIFormats()
    {
        return self::$openAPIFormats;
    }

    /**
     * If oneOf schema, get the possible response types.
     */
    public static function getComposedSchemas(): array
    {
        return [
        ];
    }

    /**
     * Return true if the model is an array.
     */
    public static function isArray(): bool
    {
        return false;
    }

    /**
     * Checks if a property is nullable.
     */
    public static function isNullable(string $property): bool
    {
        return self::openAPINullables()[$property] ?? false;
    }

    /**
     * Checks if a nullable property is set to null.
     */
    public function isNullableSetToNull(string $property): bool
    {
        return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
    }

    /**
     * Array of attributes where the key is the local name,
     * and the value is the original name.
     *
     * @return array
     */
    public static function attributeMap()
    {
        return self::$attributeMap;
    }

    /**
     * Array of attributes to setter functions (for deserialization of responses).
     *
     * @return array
     */
    public static function setters()
    {
        return self::$setters;
    }

    /**
     * Array of attributes to getter functions (for serialization of requests).
     *
     * @return array
     */
    public static function getters()
    {
        return self::$getters;
    }

    /**
     * The original name of the model.
     *
     * @return string
     */
    public function getModelName()
    {
        return self::$openAPIModelName;
    }

    /**
     * Show all the invalid properties with reasons.
     *
     * @return array invalid properties with reasons
     */
    public function listInvalidProperties()
    {
        return [];
    }

    /**
     * Validate all the properties in the model
     * return true if all passed.
     *
     * @return bool True if all properties are valid
     */
    public function valid()
    {
        return 0 === count($this->listInvalidProperties());
    }

    /**
     * Gets id.
     *
     * @return null|string
     */
    public function getId()
    {
        return $this->container['id'];
    }

    /**
     * Sets id.
     *
     * @param null|string $id id
     *
     * @return self
     */
    public function setId($id)
    {
        if (is_null($id)) {
            throw new \InvalidArgumentException('non-nullable id cannot be null');
        }
        $this->container['id'] = $id;

        return $this;
    }

    /**
     * Gets trId.
     *
     * @return null|int
     */
    public function getTrId()
    {
        return $this->container['trId'];
    }

    /**
     * Sets trId.
     *
     * @param null|int $trId trId
     *
     * @return self
     */
    public function setTrId($trId)
    {
        if (is_null($trId)) {
            throw new \InvalidArgumentException('non-nullable trId cannot be null');
        }
        $this->container['trId'] = $trId;

        return $this;
    }

    /**
     * Gets amount.
     *
     * @return null|string
     */
    public function getAmount()
    {
        return $this->container['amount'];
    }

    /**
     * Sets amount.
     *
     * @param null|string $amount amount
     *
     * @return self
     */
    public function setAmount($amount)
    {
        if (is_null($amount)) {
            throw new \InvalidArgumentException('non-nullable amount cannot be null');
        }
        $this->container['amount'] = $amount;

        return $this;
    }

    /**
     * Gets transactionFee.
     *
     * @return null|string
     */
    public function getTransactionFee()
    {
        return $this->container['transactionFee'];
    }

    /**
     * Sets transactionFee.
     *
     * @param null|string $transactionFee transactionFee
     *
     * @return self
     */
    public function setTransactionFee($transactionFee)
    {
        if (is_null($transactionFee)) {
            throw new \InvalidArgumentException('non-nullable transactionFee cannot be null');
        }
        $this->container['transactionFee'] = $transactionFee;

        return $this;
    }

    /**
     * Gets coin.
     *
     * @return null|string
     */
    public function getCoin()
    {
        return $this->container['coin'];
    }

    /**
     * Sets coin.
     *
     * @param null|string $coin coin
     *
     * @return self
     */
    public function setCoin($coin)
    {
        if (is_null($coin)) {
            throw new \InvalidArgumentException('non-nullable coin cannot be null');
        }
        $this->container['coin'] = $coin;

        return $this;
    }

    /**
     * Gets withdrawalStatus.
     *
     * @return null|int
     */
    public function getWithdrawalStatus()
    {
        return $this->container['withdrawalStatus'];
    }

    /**
     * Sets withdrawalStatus.
     *
     * @param null|int $withdrawalStatus withdrawalStatus
     *
     * @return self
     */
    public function setWithdrawalStatus($withdrawalStatus)
    {
        if (is_null($withdrawalStatus)) {
            throw new \InvalidArgumentException('non-nullable withdrawalStatus cannot be null');
        }
        $this->container['withdrawalStatus'] = $withdrawalStatus;

        return $this;
    }

    /**
     * Gets travelRuleStatus.
     *
     * @return null|int
     */
    public function getTravelRuleStatus()
    {
        return $this->container['travelRuleStatus'];
    }

    /**
     * Sets travelRuleStatus.
     *
     * @param null|int $travelRuleStatus travelRuleStatus
     *
     * @return self
     */
    public function setTravelRuleStatus($travelRuleStatus)
    {
        if (is_null($travelRuleStatus)) {
            throw new \InvalidArgumentException('non-nullable travelRuleStatus cannot be null');
        }
        $this->container['travelRuleStatus'] = $travelRuleStatus;

        return $this;
    }

    /**
     * Gets address.
     *
     * @return null|string
     */
    public function getAddress()
    {
        return $this->container['address'];
    }

    /**
     * Sets address.
     *
     * @param null|string $address address
     *
     * @return self
     */
    public function setAddress($address)
    {
        if (is_null($address)) {
            throw new \InvalidArgumentException('non-nullable address cannot be null');
        }
        $this->container['address'] = $address;

        return $this;
    }

    /**
     * Gets addressTag.
     *
     * @return null|string
     */
    public function getAddressTag()
    {
        return $this->container['addressTag'];
    }

    /**
     * Sets addressTag.
     *
     * @param null|string $addressTag addressTag
     *
     * @return self
     */
    public function setAddressTag($addressTag)
    {
        if (is_null($addressTag)) {
            throw new \InvalidArgumentException('non-nullable addressTag cannot be null');
        }
        $this->container['addressTag'] = $addressTag;

        return $this;
    }

    /**
     * Gets txId.
     *
     * @return null|string
     */
    public function getTxId()
    {
        return $this->container['txId'];
    }

    /**
     * Sets txId.
     *
     * @param null|string $txId txId
     *
     * @return self
     */
    public function setTxId($txId)
    {
        if (is_null($txId)) {
            throw new \InvalidArgumentException('non-nullable txId cannot be null');
        }
        $this->container['txId'] = $txId;

        return $this;
    }

    /**
     * Gets applyTime.
     *
     * @return null|string
     */
    public function getApplyTime()
    {
        return $this->container['applyTime'];
    }

    /**
     * Sets applyTime.
     *
     * @param null|string $applyTime applyTime
     *
     * @return self
     */
    public function setApplyTime($applyTime)
    {
        if (is_null($applyTime)) {
            throw new \InvalidArgumentException('non-nullable applyTime cannot be null');
        }
        $this->container['applyTime'] = $applyTime;

        return $this;
    }

    /**
     * Gets network.
     *
     * @return null|string
     */
    public function getNetwork()
    {
        return $this->container['network'];
    }

    /**
     * Sets network.
     *
     * @param null|string $network network
     *
     * @return self
     */
    public function setNetwork($network)
    {
        if (is_null($network)) {
            throw new \InvalidArgumentException('non-nullable network cannot be null');
        }
        $this->container['network'] = $network;

        return $this;
    }

    /**
     * Gets transferType.
     *
     * @return null|int
     */
    public function getTransferType()
    {
        return $this->container['transferType'];
    }

    /**
     * Sets transferType.
     *
     * @param null|int $transferType transferType
     *
     * @return self
     */
    public function setTransferType($transferType)
    {
        if (is_null($transferType)) {
            throw new \InvalidArgumentException('non-nullable transferType cannot be null');
        }
        $this->container['transferType'] = $transferType;

        return $this;
    }

    /**
     * Gets withdrawOrderId.
     *
     * @return null|string
     */
    public function getWithdrawOrderId()
    {
        return $this->container['withdrawOrderId'];
    }

    /**
     * Sets withdrawOrderId.
     *
     * @param null|string $withdrawOrderId withdrawOrderId
     *
     * @return self
     */
    public function setWithdrawOrderId($withdrawOrderId)
    {
        if (is_null($withdrawOrderId)) {
            throw new \InvalidArgumentException('non-nullable withdrawOrderId cannot be null');
        }
        $this->container['withdrawOrderId'] = $withdrawOrderId;

        return $this;
    }

    /**
     * Gets info.
     *
     * @return null|string
     */
    public function getInfo()
    {
        return $this->container['info'];
    }

    /**
     * Sets info.
     *
     * @param null|string $info info
     *
     * @return self
     */
    public function setInfo($info)
    {
        if (is_null($info)) {
            throw new \InvalidArgumentException('non-nullable info cannot be null');
        }
        $this->container['info'] = $info;

        return $this;
    }

    /**
     * Gets confirmNo.
     *
     * @return null|int
     */
    public function getConfirmNo()
    {
        return $this->container['confirmNo'];
    }

    /**
     * Sets confirmNo.
     *
     * @param null|int $confirmNo confirmNo
     *
     * @return self
     */
    public function setConfirmNo($confirmNo)
    {
        if (is_null($confirmNo)) {
            throw new \InvalidArgumentException('non-nullable confirmNo cannot be null');
        }
        $this->container['confirmNo'] = $confirmNo;

        return $this;
    }

    /**
     * Gets walletType.
     *
     * @return null|int
     */
    public function getWalletType()
    {
        return $this->container['walletType'];
    }

    /**
     * Sets walletType.
     *
     * @param null|int $walletType walletType
     *
     * @return self
     */
    public function setWalletType($walletType)
    {
        if (is_null($walletType)) {
            throw new \InvalidArgumentException('non-nullable walletType cannot be null');
        }
        $this->container['walletType'] = $walletType;

        return $this;
    }

    /**
     * Gets txKey.
     *
     * @return null|string
     */
    public function getTxKey()
    {
        return $this->container['txKey'];
    }

    /**
     * Sets txKey.
     *
     * @param null|string $txKey txKey
     *
     * @return self
     */
    public function setTxKey($txKey)
    {
        if (is_null($txKey)) {
            throw new \InvalidArgumentException('non-nullable txKey cannot be null');
        }
        $this->container['txKey'] = $txKey;

        return $this;
    }

    /**
     * Gets questionnaire.
     *
     * @return null|string
     */
    public function getQuestionnaire()
    {
        return $this->container['questionnaire'];
    }

    /**
     * Sets questionnaire.
     *
     * @param null|string $questionnaire questionnaire
     *
     * @return self
     */
    public function setQuestionnaire($questionnaire)
    {
        if (is_null($questionnaire)) {
            throw new \InvalidArgumentException('non-nullable questionnaire cannot be null');
        }
        $this->container['questionnaire'] = $questionnaire;

        return $this;
    }

    /**
     * Gets completeTime.
     *
     * @return null|string
     */
    public function getCompleteTime()
    {
        return $this->container['completeTime'];
    }

    /**
     * Sets completeTime.
     *
     * @param null|string $completeTime completeTime
     *
     * @return self
     */
    public function setCompleteTime($completeTime)
    {
        if (is_null($completeTime)) {
            throw new \InvalidArgumentException('non-nullable completeTime cannot be null');
        }
        $this->container['completeTime'] = $completeTime;

        return $this;
    }

    /**
     * Returns true if offset exists. False otherwise.
     *
     * @param int $offset Offset
     */
    public function offsetExists($offset): bool
    {
        return isset($this->container[$offset]);
    }

    /**
     * Gets offset.
     *
     * @param int $offset Offset
     *
     * @return null|mixed
     */
    #[\ReturnTypeWillChange]
    public function offsetGet($offset)
    {
        return $this->container[$offset] ?? null;
    }

    /**
     * Sets value based on offset.
     *
     * @param null|int $offset Offset
     * @param mixed    $value  Value to be set
     */
    public function offsetSet($offset, $value): void
    {
        if (is_null($offset)) {
            $this->container[] = $value;
        } else {
            $this->container[$offset] = $value;
        }
    }

    /**
     * Unsets offset.
     *
     * @param int $offset Offset
     */
    public function offsetUnset($offset): void
    {
        unset($this->container[$offset]);
    }

    /**
     * Serializes the object to a value that can be serialized natively by json_encode().
     *
     * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php
     *
     * @return mixed returns data which can be serialized by json_encode(), which is a value
     *               of any type other than a resource
     */
    #[\ReturnTypeWillChange]
    public function jsonSerialize()
    {
        return ObjectSerializer::sanitizeForSerialization($this);
    }

    /**
     * Gets a header-safe presentation of the object.
     *
     * @return string
     */
    public function toHeaderValue()
    {
        return json_encode(ObjectSerializer::sanitizeForSerialization($this));
    }

    /**
     * Array of nullable properties.
     */
    protected static function openAPINullables(): array
    {
        return self::$openAPINullables;
    }

    /**
     * Array of nullable field names deliberately set to null.
     *
     * @return bool[]
     */
    private function getOpenAPINullablesSetToNull(): array
    {
        return $this->openAPINullablesSetToNull;
    }

    /**
     * Setter - Array of nullable field names deliberately set to null.
     *
     * @param bool[] $openAPINullablesSetToNull
     */
    private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
    {
        $this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
    }

    /**
     * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
     * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
     * $this->openAPINullablesSetToNull array.
     *
     * @param mixed $defaultValue
     */
    private function setIfExists(string $variableName, array $fields, $defaultValue): void
    {
        if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
            $this->openAPINullablesSetToNull[] = $variableName;
        }

        $this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
    }
}
