*/ class BlockDetailsModel implements ModelInterface, ArrayAccess, JsonSerializable { public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ protected static string $openAPIModelName = 'BlockDetailsModel'; /** * Array of property to type mappings. Used for (de)serialization * * @var array */ protected static array $openAPITypes = [ 'actual_timestamp' => 'int', 'already_generated_coins' => 'string', 'base_reward' => 'int', 'blob' => 'string', 'block_cumulative_size' => 'int', 'block_tself_size' => 'int', 'cumulative_diff_adjusted' => 'string', 'cumulative_diff_precise' => 'string', 'difficulty' => 'string', 'effective_fee_median' => 'int', 'height' => 'int', 'id' => 'string', 'is_orphan' => 'bool', 'miner_text_info' => 'string', 'object_in_json' => 'string', 'penalty' => 'int', 'pow_seed' => 'string', 'prev_id' => 'string', 'summary_reward' => 'int', 'this_block_fee_median' => 'int', 'timestamp' => 'int', 'total_fee' => 'int', 'total_txs_size' => 'int', 'transactions_details' => '\lthn\lthn\TransactionDetailsModel[]', 'type' => 'int' ]; /** * Array of property to format mappings. Used for (de)serialization * * @var array */ protected static array $openAPIFormats = [ 'actual_timestamp' => null, 'already_generated_coins' => null, 'base_reward' => null, 'blob' => null, 'block_cumulative_size' => null, 'block_tself_size' => null, 'cumulative_diff_adjusted' => null, 'cumulative_diff_precise' => null, 'difficulty' => null, 'effective_fee_median' => null, 'height' => null, 'id' => null, 'is_orphan' => null, 'miner_text_info' => null, 'object_in_json' => null, 'penalty' => null, 'pow_seed' => null, 'prev_id' => null, 'summary_reward' => null, 'this_block_fee_median' => null, 'timestamp' => null, 'total_fee' => null, 'total_txs_size' => null, 'transactions_details' => null, 'type' => null ]; /** * Array of nullable properties. Used for (de)serialization * * @var array */ protected static array $openAPINullables = [ 'actual_timestamp' => false, 'already_generated_coins' => false, 'base_reward' => false, 'blob' => false, 'block_cumulative_size' => false, 'block_tself_size' => false, 'cumulative_diff_adjusted' => false, 'cumulative_diff_precise' => false, 'difficulty' => false, 'effective_fee_median' => false, 'height' => false, 'id' => false, 'is_orphan' => false, 'miner_text_info' => false, 'object_in_json' => false, 'penalty' => false, 'pow_seed' => false, 'prev_id' => false, 'summary_reward' => false, 'this_block_fee_median' => false, 'timestamp' => false, 'total_fee' => false, 'total_txs_size' => false, 'transactions_details' => false, 'type' => false ]; /** * If a nullable field gets set to null, insert it here * * @var array */ protected array $openAPINullablesSetToNull = []; /** * Array of property to type mappings. Used for (de)serialization * * @return array */ public static function openAPITypes(): array { return self::$openAPITypes; } /** * Array of property to format mappings. Used for (de)serialization * * @return array */ public static function openAPIFormats(): array { return self::$openAPIFormats; } /** * Array of nullable properties * * @return array */ protected static function openAPINullables(): array { return self::$openAPINullables; } /** * Array of nullable field names deliberately set to null * * @return array */ private function getOpenAPINullablesSetToNull(): array { return $this->openAPINullablesSetToNull; } /** * Setter - Array of nullable field names deliberately set to null * * @param array $openAPINullablesSetToNull */ private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void { $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; } /** * Checks if a property is nullable * * @param string $property * @return bool */ public static function isNullable(string $property): bool { return self::openAPINullables()[$property] ?? false; } /** * Checks if a nullable property is set to null. * * @param string $property * @return bool */ 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 * * @var array */ protected static array $attributeMap = [ 'actual_timestamp' => 'actual_timestamp', 'already_generated_coins' => 'already_generated_coins', 'base_reward' => 'base_reward', 'blob' => 'blob', 'block_cumulative_size' => 'block_cumulative_size', 'block_tself_size' => 'block_tself_size', 'cumulative_diff_adjusted' => 'cumulative_diff_adjusted', 'cumulative_diff_precise' => 'cumulative_diff_precise', 'difficulty' => 'difficulty', 'effective_fee_median' => 'effective_fee_median', 'height' => 'height', 'id' => 'id', 'is_orphan' => 'is_orphan', 'miner_text_info' => 'miner_text_info', 'object_in_json' => 'object_in_json', 'penalty' => 'penalty', 'pow_seed' => 'pow_seed', 'prev_id' => 'prev_id', 'summary_reward' => 'summary_reward', 'this_block_fee_median' => 'this_block_fee_median', 'timestamp' => 'timestamp', 'total_fee' => 'total_fee', 'total_txs_size' => 'total_txs_size', 'transactions_details' => 'transactions_details', 'type' => 'type' ]; /** * Array of attributes to setter functions (for deserialization of responses) * * @var array */ protected static array $setters = [ 'actual_timestamp' => 'setActualTimestamp', 'already_generated_coins' => 'setAlreadyGeneratedCoins', 'base_reward' => 'setBaseReward', 'blob' => 'setBlob', 'block_cumulative_size' => 'setBlockCumulativeSize', 'block_tself_size' => 'setBlockTselfSize', 'cumulative_diff_adjusted' => 'setCumulativeDiffAdjusted', 'cumulative_diff_precise' => 'setCumulativeDiffPrecise', 'difficulty' => 'setDifficulty', 'effective_fee_median' => 'setEffectiveFeeMedian', 'height' => 'setHeight', 'id' => 'setId', 'is_orphan' => 'setIsOrphan', 'miner_text_info' => 'setMinerTextInfo', 'object_in_json' => 'setObjectInJson', 'penalty' => 'setPenalty', 'pow_seed' => 'setPowSeed', 'prev_id' => 'setPrevId', 'summary_reward' => 'setSummaryReward', 'this_block_fee_median' => 'setThisBlockFeeMedian', 'timestamp' => 'setTimestamp', 'total_fee' => 'setTotalFee', 'total_txs_size' => 'setTotalTxsSize', 'transactions_details' => 'setTransactionsDetails', 'type' => 'setType' ]; /** * Array of attributes to getter functions (for serialization of requests) * * @var array */ protected static array $getters = [ 'actual_timestamp' => 'getActualTimestamp', 'already_generated_coins' => 'getAlreadyGeneratedCoins', 'base_reward' => 'getBaseReward', 'blob' => 'getBlob', 'block_cumulative_size' => 'getBlockCumulativeSize', 'block_tself_size' => 'getBlockTselfSize', 'cumulative_diff_adjusted' => 'getCumulativeDiffAdjusted', 'cumulative_diff_precise' => 'getCumulativeDiffPrecise', 'difficulty' => 'getDifficulty', 'effective_fee_median' => 'getEffectiveFeeMedian', 'height' => 'getHeight', 'id' => 'getId', 'is_orphan' => 'getIsOrphan', 'miner_text_info' => 'getMinerTextInfo', 'object_in_json' => 'getObjectInJson', 'penalty' => 'getPenalty', 'pow_seed' => 'getPowSeed', 'prev_id' => 'getPrevId', 'summary_reward' => 'getSummaryReward', 'this_block_fee_median' => 'getThisBlockFeeMedian', 'timestamp' => 'getTimestamp', 'total_fee' => 'getTotalFee', 'total_txs_size' => 'getTotalTxsSize', 'transactions_details' => 'getTransactionsDetails', 'type' => 'getType' ]; /** * Array of attributes where the key is the local name, * and the value is the original name * * @return array */ public static function attributeMap(): array { return self::$attributeMap; } /** * Array of attributes to setter functions (for deserialization of responses) * * @return array */ public static function setters(): array { return self::$setters; } /** * Array of attributes to getter functions (for serialization of requests) * * @return array */ public static function getters(): array { return self::$getters; } /** * The original name of the model. * * @return string */ public function getModelName(): string { return self::$openAPIModelName; } /** * Associative array for storing property values * * @var array */ protected array $container = []; /** * Constructor * * @param array $data Associated array of property values initializing the model */ public function __construct(?array $data = null) { $this->setIfExists('actual_timestamp', $data ?? [], null); $this->setIfExists('already_generated_coins', $data ?? [], null); $this->setIfExists('base_reward', $data ?? [], null); $this->setIfExists('blob', $data ?? [], null); $this->setIfExists('block_cumulative_size', $data ?? [], null); $this->setIfExists('block_tself_size', $data ?? [], null); $this->setIfExists('cumulative_diff_adjusted', $data ?? [], null); $this->setIfExists('cumulative_diff_precise', $data ?? [], null); $this->setIfExists('difficulty', $data ?? [], null); $this->setIfExists('effective_fee_median', $data ?? [], null); $this->setIfExists('height', $data ?? [], null); $this->setIfExists('id', $data ?? [], null); $this->setIfExists('is_orphan', $data ?? [], null); $this->setIfExists('miner_text_info', $data ?? [], null); $this->setIfExists('object_in_json', $data ?? [], null); $this->setIfExists('penalty', $data ?? [], null); $this->setIfExists('pow_seed', $data ?? [], null); $this->setIfExists('prev_id', $data ?? [], null); $this->setIfExists('summary_reward', $data ?? [], null); $this->setIfExists('this_block_fee_median', $data ?? [], null); $this->setIfExists('timestamp', $data ?? [], null); $this->setIfExists('total_fee', $data ?? [], null); $this->setIfExists('total_txs_size', $data ?? [], null); $this->setIfExists('transactions_details', $data ?? [], null); $this->setIfExists('type', $data ?? [], null); } /** * 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 string $variableName * @param array $fields * @param mixed $defaultValue */ private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void { if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { $this->openAPINullablesSetToNull[] = $variableName; } $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** * Show all the invalid properties with reasons. * * @return string[] invalid properties with reasons */ public function listInvalidProperties(): array { $invalidProperties = []; if (!is_null($this->container['type']) && ($this->container['type'] > 4294967295)) { $invalidProperties[] = "invalid value for 'type', must be smaller than or equal to 4294967295."; } if (!is_null($this->container['type']) && ($this->container['type'] < 0)) { $invalidProperties[] = "invalid value for 'type', must be bigger than or equal to 0."; } return $invalidProperties; } /** * Validate all the properties in the model * return true if all passed * * @return bool True if all properties are valid */ public function valid(): bool { return count($this->listInvalidProperties()) === 0; } /** * Gets actual_timestamp * * @return int|null */ public function getActualTimestamp(): ?int { return $this->container['actual_timestamp']; } /** * Sets actual_timestamp * * @param int|null $actual_timestamp actual_timestamp * * @return $this */ public function setActualTimestamp(?int $actual_timestamp): static { if (is_null($actual_timestamp)) { throw new InvalidArgumentException('non-nullable actual_timestamp cannot be null'); } $this->container['actual_timestamp'] = $actual_timestamp; return $this; } /** * Gets already_generated_coins * * @return string|null */ public function getAlreadyGeneratedCoins(): ?string { return $this->container['already_generated_coins']; } /** * Sets already_generated_coins * * @param string|null $already_generated_coins already_generated_coins * * @return $this */ public function setAlreadyGeneratedCoins(?string $already_generated_coins): static { if (is_null($already_generated_coins)) { throw new InvalidArgumentException('non-nullable already_generated_coins cannot be null'); } $this->container['already_generated_coins'] = $already_generated_coins; return $this; } /** * Gets base_reward * * @return int|null */ public function getBaseReward(): ?int { return $this->container['base_reward']; } /** * Sets base_reward * * @param int|null $base_reward base_reward * * @return $this */ public function setBaseReward(?int $base_reward): static { if (is_null($base_reward)) { throw new InvalidArgumentException('non-nullable base_reward cannot be null'); } $this->container['base_reward'] = $base_reward; return $this; } /** * Gets blob * * @return string|null */ public function getBlob(): ?string { return $this->container['blob']; } /** * Sets blob * * @param string|null $blob blob * * @return $this */ public function setBlob(?string $blob): static { if (is_null($blob)) { throw new InvalidArgumentException('non-nullable blob cannot be null'); } $this->container['blob'] = $blob; return $this; } /** * Gets block_cumulative_size * * @return int|null */ public function getBlockCumulativeSize(): ?int { return $this->container['block_cumulative_size']; } /** * Sets block_cumulative_size * * @param int|null $block_cumulative_size block_cumulative_size * * @return $this */ public function setBlockCumulativeSize(?int $block_cumulative_size): static { if (is_null($block_cumulative_size)) { throw new InvalidArgumentException('non-nullable block_cumulative_size cannot be null'); } $this->container['block_cumulative_size'] = $block_cumulative_size; return $this; } /** * Gets block_tself_size * * @return int|null */ public function getBlockTselfSize(): ?int { return $this->container['block_tself_size']; } /** * Sets block_tself_size * * @param int|null $block_tself_size block_tself_size * * @return $this */ public function setBlockTselfSize(?int $block_tself_size): static { if (is_null($block_tself_size)) { throw new InvalidArgumentException('non-nullable block_tself_size cannot be null'); } $this->container['block_tself_size'] = $block_tself_size; return $this; } /** * Gets cumulative_diff_adjusted * * @return string|null */ public function getCumulativeDiffAdjusted(): ?string { return $this->container['cumulative_diff_adjusted']; } /** * Sets cumulative_diff_adjusted * * @param string|null $cumulative_diff_adjusted cumulative_diff_adjusted * * @return $this */ public function setCumulativeDiffAdjusted(?string $cumulative_diff_adjusted): static { if (is_null($cumulative_diff_adjusted)) { throw new InvalidArgumentException('non-nullable cumulative_diff_adjusted cannot be null'); } $this->container['cumulative_diff_adjusted'] = $cumulative_diff_adjusted; return $this; } /** * Gets cumulative_diff_precise * * @return string|null */ public function getCumulativeDiffPrecise(): ?string { return $this->container['cumulative_diff_precise']; } /** * Sets cumulative_diff_precise * * @param string|null $cumulative_diff_precise cumulative_diff_precise * * @return $this */ public function setCumulativeDiffPrecise(?string $cumulative_diff_precise): static { if (is_null($cumulative_diff_precise)) { throw new InvalidArgumentException('non-nullable cumulative_diff_precise cannot be null'); } $this->container['cumulative_diff_precise'] = $cumulative_diff_precise; return $this; } /** * Gets difficulty * * @return string|null */ public function getDifficulty(): ?string { return $this->container['difficulty']; } /** * Sets difficulty * * @param string|null $difficulty difficulty * * @return $this */ public function setDifficulty(?string $difficulty): static { if (is_null($difficulty)) { throw new InvalidArgumentException('non-nullable difficulty cannot be null'); } $this->container['difficulty'] = $difficulty; return $this; } /** * Gets effective_fee_median * * @return int|null */ public function getEffectiveFeeMedian(): ?int { return $this->container['effective_fee_median']; } /** * Sets effective_fee_median * * @param int|null $effective_fee_median effective_fee_median * * @return $this */ public function setEffectiveFeeMedian(?int $effective_fee_median): static { if (is_null($effective_fee_median)) { throw new InvalidArgumentException('non-nullable effective_fee_median cannot be null'); } $this->container['effective_fee_median'] = $effective_fee_median; return $this; } /** * Gets height * * @return int|null */ public function getHeight(): ?int { return $this->container['height']; } /** * Sets height * * @param int|null $height height * * @return $this */ public function setHeight(?int $height): static { if (is_null($height)) { throw new InvalidArgumentException('non-nullable height cannot be null'); } $this->container['height'] = $height; return $this; } /** * Gets id * * @return string|null */ public function getId(): ?string { return $this->container['id']; } /** * Sets id * * @param string|null $id id * * @return $this */ public function setId(?string $id): static { if (is_null($id)) { throw new InvalidArgumentException('non-nullable id cannot be null'); } $this->container['id'] = $id; return $this; } /** * Gets is_orphan * * @return bool|null */ public function getIsOrphan(): ?bool { return $this->container['is_orphan']; } /** * Sets is_orphan * * @param bool|null $is_orphan is_orphan * * @return $this */ public function setIsOrphan(?bool $is_orphan): static { if (is_null($is_orphan)) { throw new InvalidArgumentException('non-nullable is_orphan cannot be null'); } $this->container['is_orphan'] = $is_orphan; return $this; } /** * Gets miner_text_info * * @return string|null */ public function getMinerTextInfo(): ?string { return $this->container['miner_text_info']; } /** * Sets miner_text_info * * @param string|null $miner_text_info miner_text_info * * @return $this */ public function setMinerTextInfo(?string $miner_text_info): static { if (is_null($miner_text_info)) { throw new InvalidArgumentException('non-nullable miner_text_info cannot be null'); } $this->container['miner_text_info'] = $miner_text_info; return $this; } /** * Gets object_in_json * * @return string|null */ public function getObjectInJson(): ?string { return $this->container['object_in_json']; } /** * Sets object_in_json * * @param string|null $object_in_json object_in_json * * @return $this */ public function setObjectInJson(?string $object_in_json): static { if (is_null($object_in_json)) { throw new InvalidArgumentException('non-nullable object_in_json cannot be null'); } $this->container['object_in_json'] = $object_in_json; return $this; } /** * Gets penalty * * @return int|null */ public function getPenalty(): ?int { return $this->container['penalty']; } /** * Sets penalty * * @param int|null $penalty penalty * * @return $this */ public function setPenalty(?int $penalty): static { if (is_null($penalty)) { throw new InvalidArgumentException('non-nullable penalty cannot be null'); } $this->container['penalty'] = $penalty; return $this; } /** * Gets pow_seed * * @return string|null */ public function getPowSeed(): ?string { return $this->container['pow_seed']; } /** * Sets pow_seed * * @param string|null $pow_seed pow_seed * * @return $this */ public function setPowSeed(?string $pow_seed): static { if (is_null($pow_seed)) { throw new InvalidArgumentException('non-nullable pow_seed cannot be null'); } $this->container['pow_seed'] = $pow_seed; return $this; } /** * Gets prev_id * * @return string|null */ public function getPrevId(): ?string { return $this->container['prev_id']; } /** * Sets prev_id * * @param string|null $prev_id prev_id * * @return $this */ public function setPrevId(?string $prev_id): static { if (is_null($prev_id)) { throw new InvalidArgumentException('non-nullable prev_id cannot be null'); } $this->container['prev_id'] = $prev_id; return $this; } /** * Gets summary_reward * * @return int|null */ public function getSummaryReward(): ?int { return $this->container['summary_reward']; } /** * Sets summary_reward * * @param int|null $summary_reward summary_reward * * @return $this */ public function setSummaryReward(?int $summary_reward): static { if (is_null($summary_reward)) { throw new InvalidArgumentException('non-nullable summary_reward cannot be null'); } $this->container['summary_reward'] = $summary_reward; return $this; } /** * Gets this_block_fee_median * * @return int|null */ public function getThisBlockFeeMedian(): ?int { return $this->container['this_block_fee_median']; } /** * Sets this_block_fee_median * * @param int|null $this_block_fee_median this_block_fee_median * * @return $this */ public function setThisBlockFeeMedian(?int $this_block_fee_median): static { if (is_null($this_block_fee_median)) { throw new InvalidArgumentException('non-nullable this_block_fee_median cannot be null'); } $this->container['this_block_fee_median'] = $this_block_fee_median; return $this; } /** * Gets timestamp * * @return int|null */ public function getTimestamp(): ?int { return $this->container['timestamp']; } /** * Sets timestamp * * @param int|null $timestamp timestamp * * @return $this */ public function setTimestamp(?int $timestamp): static { if (is_null($timestamp)) { throw new InvalidArgumentException('non-nullable timestamp cannot be null'); } $this->container['timestamp'] = $timestamp; return $this; } /** * Gets total_fee * * @return int|null */ public function getTotalFee(): ?int { return $this->container['total_fee']; } /** * Sets total_fee * * @param int|null $total_fee total_fee * * @return $this */ public function setTotalFee(?int $total_fee): static { if (is_null($total_fee)) { throw new InvalidArgumentException('non-nullable total_fee cannot be null'); } $this->container['total_fee'] = $total_fee; return $this; } /** * Gets total_txs_size * * @return int|null */ public function getTotalTxsSize(): ?int { return $this->container['total_txs_size']; } /** * Sets total_txs_size * * @param int|null $total_txs_size total_txs_size * * @return $this */ public function setTotalTxsSize(?int $total_txs_size): static { if (is_null($total_txs_size)) { throw new InvalidArgumentException('non-nullable total_txs_size cannot be null'); } $this->container['total_txs_size'] = $total_txs_size; return $this; } /** * Gets transactions_details * * @return \lthn\lthn\TransactionDetailsModel[]|null */ public function getTransactionsDetails(): ?array { return $this->container['transactions_details']; } /** * Sets transactions_details * * @param \lthn\lthn\TransactionDetailsModel[]|null $transactions_details transactions_details * * @return $this */ public function setTransactionsDetails(?array $transactions_details): static { if (is_null($transactions_details)) { throw new InvalidArgumentException('non-nullable transactions_details cannot be null'); } $this->container['transactions_details'] = $transactions_details; return $this; } /** * Gets type * * @return int|null */ public function getType(): ?int { return $this->container['type']; } /** * Sets type * * @param int|null $type type * * @return $this */ public function setType(?int $type): static { if (is_null($type)) { throw new InvalidArgumentException('non-nullable type cannot be null'); } if (($type > 4294967295)) { throw new InvalidArgumentException('invalid value for $type when calling BlockDetailsModel., must be smaller than or equal to 4294967295.'); } if (($type < 0)) { throw new InvalidArgumentException('invalid value for $type when calling BlockDetailsModel., must be bigger than or equal to 0.'); } $this->container['type'] = $type; return $this; } /** * Returns true if offset exists. False otherwise. * * @param integer $offset Offset * * @return boolean */ public function offsetExists(mixed $offset): bool { return isset($this->container[$offset]); } /** * Gets offset. * * @param integer $offset Offset * * @return mixed|null */ #[ReturnTypeWillChange] public function offsetGet(mixed $offset): mixed { return $this->container[$offset] ?? null; } /** * Sets value based on offset. * * @param int|null $offset Offset * @param mixed $value Value to be set * * @return void */ public function offsetSet(mixed $offset, mixed $value): void { if (is_null($offset)) { $this->container[] = $value; } else { $this->container[$offset] = $value; } } /** * Unsets offset. * * @param integer $offset Offset * * @return void */ public function offsetUnset(mixed $offset): void { unset($this->container[$offset]); } /** * Serializes the object to a value that can be serialized natively by json_encode(). * @link 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(): mixed { return ObjectSerializer::sanitizeForSerialization($this); } /** * Gets the string presentation of the object * * @return string */ public function __toString(): string { return json_encode( ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT ); } /** * Gets a header-safe presentation of the object * * @return string */ public function toHeaderValue(): string { return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } }