*/ class GetApiV3AdminCreditOverview200ResponseDataLastSettlement implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ protected static $openAPIModelName = 'get_api_v3_admin_credit_overview_200_response_data_last_settlement'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ protected static $openAPITypes = [ 'mode' => 'string', 'from' => 'string', 'to' => 'string', 'users' => 'int', 'pairs' => 'int', 'trigger' => 'string', 'operator' => 'string', 'ran_at' => 'string', 'seconds' => 'float' ]; /** * Array of property to format mappings. Used for (de)serialization * * @var string[] * @phpstan-var array * @psalm-var array */ protected static $openAPIFormats = [ 'mode' => null, 'from' => null, 'to' => null, 'users' => null, 'pairs' => null, 'trigger' => null, 'operator' => null, 'ran_at' => null, 'seconds' => null ]; /** * Array of nullable properties. Used for (de)serialization * * @var boolean[] */ protected static array $openAPINullables = [ 'mode' => false, 'from' => false, 'to' => false, 'users' => false, 'pairs' => false, 'trigger' => false, 'operator' => false, 'ran_at' => false, 'seconds' => false ]; /** * If a nullable field gets set to null, insert it here * * @var boolean[] */ protected array $openAPINullablesSetToNull = []; /** * 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; } /** * Array of nullable properties * * @return array */ protected static function openAPINullables(): array { return self::$openAPINullables; } /** * Array of nullable field names deliberately set to null * * @return boolean[] */ private function getOpenAPINullablesSetToNull(): array { return $this->openAPINullablesSetToNull; } /** * Setter - Array of nullable field names deliberately set to null * * @param boolean[] $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 string[] */ protected static $attributeMap = [ 'mode' => 'mode', 'from' => 'from', 'to' => 'to', 'users' => 'users', 'pairs' => 'pairs', 'trigger' => 'trigger', 'operator' => 'operator', 'ran_at' => 'ran_at', 'seconds' => 'seconds' ]; /** * Array of attributes to setter functions (for deserialization of responses) * * @var string[] */ protected static $setters = [ 'mode' => 'setMode', 'from' => 'setFrom', 'to' => 'setTo', 'users' => 'setUsers', 'pairs' => 'setPairs', 'trigger' => 'setTrigger', 'operator' => 'setOperator', 'ran_at' => 'setRanAt', 'seconds' => 'setSeconds' ]; /** * Array of attributes to getter functions (for serialization of requests) * * @var string[] */ protected static $getters = [ 'mode' => 'getMode', 'from' => 'getFrom', 'to' => 'getTo', 'users' => 'getUsers', 'pairs' => 'getPairs', 'trigger' => 'getTrigger', 'operator' => 'getOperator', 'ran_at' => 'getRanAt', 'seconds' => 'getSeconds' ]; /** * 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; } /** * Associative array for storing property values * * @var mixed[] */ protected $container = []; /** * Constructor * * @param mixed[]|null $data Associated array of property values * initializing the model */ public function __construct(?array $data = null) { $this->setIfExists('mode', $data ?? [], null); $this->setIfExists('from', $data ?? [], null); $this->setIfExists('to', $data ?? [], null); $this->setIfExists('users', $data ?? [], null); $this->setIfExists('pairs', $data ?? [], null); $this->setIfExists('trigger', $data ?? [], null); $this->setIfExists('operator', $data ?? [], null); $this->setIfExists('ran_at', $data ?? [], null); $this->setIfExists('seconds', $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, $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 array invalid properties with reasons */ public function listInvalidProperties() { $invalidProperties = []; 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() { return count($this->listInvalidProperties()) === 0; } /** * Gets mode * * @return string|null */ public function getMode() { return $this->container['mode']; } /** * Sets mode * * @param string|null $mode mode * * @return self */ public function setMode($mode) { if (is_null($mode)) { throw new \InvalidArgumentException('non-nullable mode cannot be null'); } $this->container['mode'] = $mode; return $this; } /** * Gets from * * @return string|null */ public function getFrom() { return $this->container['from']; } /** * Sets from * * @param string|null $from from * * @return self */ public function setFrom($from) { if (is_null($from)) { throw new \InvalidArgumentException('non-nullable from cannot be null'); } $this->container['from'] = $from; return $this; } /** * Gets to * * @return string|null */ public function getTo() { return $this->container['to']; } /** * Sets to * * @param string|null $to to * * @return self */ public function setTo($to) { if (is_null($to)) { throw new \InvalidArgumentException('non-nullable to cannot be null'); } $this->container['to'] = $to; return $this; } /** * Gets users * * @return int|null */ public function getUsers() { return $this->container['users']; } /** * Sets users * * @param int|null $users users * * @return self */ public function setUsers($users) { if (is_null($users)) { throw new \InvalidArgumentException('non-nullable users cannot be null'); } $this->container['users'] = $users; return $this; } /** * Gets pairs * * @return int|null */ public function getPairs() { return $this->container['pairs']; } /** * Sets pairs * * @param int|null $pairs pairs * * @return self */ public function setPairs($pairs) { if (is_null($pairs)) { throw new \InvalidArgumentException('non-nullable pairs cannot be null'); } $this->container['pairs'] = $pairs; return $this; } /** * Gets trigger * * @return string|null */ public function getTrigger() { return $this->container['trigger']; } /** * Sets trigger * * @param string|null $trigger trigger * * @return self */ public function setTrigger($trigger) { if (is_null($trigger)) { throw new \InvalidArgumentException('non-nullable trigger cannot be null'); } $this->container['trigger'] = $trigger; return $this; } /** * Gets operator * * @return string|null */ public function getOperator() { return $this->container['operator']; } /** * Sets operator * * @param string|null $operator operator * * @return self */ public function setOperator($operator) { if (is_null($operator)) { throw new \InvalidArgumentException('non-nullable operator cannot be null'); } $this->container['operator'] = $operator; return $this; } /** * Gets ran_at * * @return string|null */ public function getRanAt() { return $this->container['ran_at']; } /** * Sets ran_at * * @param string|null $ran_at ran_at * * @return self */ public function setRanAt($ran_at) { if (is_null($ran_at)) { throw new \InvalidArgumentException('non-nullable ran_at cannot be null'); } $this->container['ran_at'] = $ran_at; return $this; } /** * Gets seconds * * @return float|null */ public function getSeconds() { return $this->container['seconds']; } /** * Sets seconds * * @param float|null $seconds seconds * * @return self */ public function setSeconds($seconds) { if (is_null($seconds)) { throw new \InvalidArgumentException('non-nullable seconds cannot be null'); } $this->container['seconds'] = $seconds; return $this; } /** * Returns true if offset exists. False otherwise. * * @param integer|string $offset Offset * * @return boolean */ public function offsetExists(mixed $offset): bool { return isset($this->container[$offset]); } /** * Gets offset. * * @param integer|string $offset Offset * * @return mixed|null */ #[\ReturnTypeWillChange] public function offsetGet(mixed $offset) { 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($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; } else { $this->container[$offset] = $value; } } /** * Unsets offset. * * @param integer|string $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() { return ObjectSerializer::sanitizeForSerialization($this); } /** * Gets the string presentation of the object * * @return string */ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT ); } /** * Gets a header-safe presentation of the object * * @return string */ public function toHeaderValue() { return json_encode(ObjectSerializer::sanitizeForSerialization($this)); } }