*/ class PostApiV3TipitakaExports200ResponseData implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ protected static $openAPIModelName = 'post_api_v3_tipitaka_exports_200_response_data'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ protected static $openAPITypes = [ 'id' => 'string', 'status' => 'string', 'format' => 'string', 'progress' => 'float', 'message' => 'string', 'title' => 'string', 'works' => 'int', 'filename' => 'string', 'content_type' => 'string', 'size' => 'int', 'ready_at' => 'string', 'expires_at' => 'string', 'download_url' => 'string' ]; /** * Array of property to format mappings. Used for (de)serialization * * @var string[] * @phpstan-var array * @psalm-var array */ protected static $openAPIFormats = [ 'id' => null, 'status' => null, 'format' => null, 'progress' => null, 'message' => null, 'title' => null, 'works' => null, 'filename' => null, 'content_type' => null, 'size' => null, 'ready_at' => null, 'expires_at' => null, 'download_url' => null ]; /** * Array of nullable properties. Used for (de)serialization * * @var boolean[] */ protected static array $openAPINullables = [ 'id' => false, 'status' => false, 'format' => false, 'progress' => false, 'message' => true, 'title' => false, 'works' => false, 'filename' => false, 'content_type' => false, 'size' => true, 'ready_at' => true, 'expires_at' => true, 'download_url' => true ]; /** * 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 = [ 'id' => 'id', 'status' => 'status', 'format' => 'format', 'progress' => 'progress', 'message' => 'message', 'title' => 'title', 'works' => 'works', 'filename' => 'filename', 'content_type' => 'content_type', 'size' => 'size', 'ready_at' => 'ready_at', 'expires_at' => 'expires_at', 'download_url' => 'download_url' ]; /** * Array of attributes to setter functions (for deserialization of responses) * * @var string[] */ protected static $setters = [ 'id' => 'setId', 'status' => 'setStatus', 'format' => 'setFormat', 'progress' => 'setProgress', 'message' => 'setMessage', 'title' => 'setTitle', 'works' => 'setWorks', 'filename' => 'setFilename', 'content_type' => 'setContentType', 'size' => 'setSize', 'ready_at' => 'setReadyAt', 'expires_at' => 'setExpiresAt', 'download_url' => 'setDownloadUrl' ]; /** * Array of attributes to getter functions (for serialization of requests) * * @var string[] */ protected static $getters = [ 'id' => 'getId', 'status' => 'getStatus', 'format' => 'getFormat', 'progress' => 'getProgress', 'message' => 'getMessage', 'title' => 'getTitle', 'works' => 'getWorks', 'filename' => 'getFilename', 'content_type' => 'getContentType', 'size' => 'getSize', 'ready_at' => 'getReadyAt', 'expires_at' => 'getExpiresAt', 'download_url' => 'getDownloadUrl' ]; /** * 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('id', $data ?? [], null); $this->setIfExists('status', $data ?? [], null); $this->setIfExists('format', $data ?? [], null); $this->setIfExists('progress', $data ?? [], null); $this->setIfExists('message', $data ?? [], null); $this->setIfExists('title', $data ?? [], null); $this->setIfExists('works', $data ?? [], null); $this->setIfExists('filename', $data ?? [], null); $this->setIfExists('content_type', $data ?? [], null); $this->setIfExists('size', $data ?? [], null); $this->setIfExists('ready_at', $data ?? [], null); $this->setIfExists('expires_at', $data ?? [], null); $this->setIfExists('download_url', $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 id * * @return string|null */ public function getId() { return $this->container['id']; } /** * Sets id * * @param string|null $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 status * * @return string|null */ public function getStatus() { return $this->container['status']; } /** * Sets status * * @param string|null $status status * * @return self */ public function setStatus($status) { if (is_null($status)) { throw new \InvalidArgumentException('non-nullable status cannot be null'); } $this->container['status'] = $status; return $this; } /** * Gets format * * @return string|null */ public function getFormat() { return $this->container['format']; } /** * Sets format * * @param string|null $format format * * @return self */ public function setFormat($format) { if (is_null($format)) { throw new \InvalidArgumentException('non-nullable format cannot be null'); } $this->container['format'] = $format; return $this; } /** * Gets progress * * @return float|null */ public function getProgress() { return $this->container['progress']; } /** * Sets progress * * @param float|null $progress progress * * @return self */ public function setProgress($progress) { if (is_null($progress)) { throw new \InvalidArgumentException('non-nullable progress cannot be null'); } $this->container['progress'] = $progress; return $this; } /** * Gets message * * @return string|null */ public function getMessage() { return $this->container['message']; } /** * Sets message * * @param string|null $message message * * @return self */ public function setMessage($message) { if (is_null($message)) { array_push($this->openAPINullablesSetToNull, 'message'); } else { $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); $index = array_search('message', $nullablesSetToNull); if ($index !== FALSE) { unset($nullablesSetToNull[$index]); $this->setOpenAPINullablesSetToNull($nullablesSetToNull); } } $this->container['message'] = $message; return $this; } /** * Gets title * * @return string|null */ public function getTitle() { return $this->container['title']; } /** * Sets title * * @param string|null $title title * * @return self */ public function setTitle($title) { if (is_null($title)) { throw new \InvalidArgumentException('non-nullable title cannot be null'); } $this->container['title'] = $title; return $this; } /** * Gets works * * @return int|null */ public function getWorks() { return $this->container['works']; } /** * Sets works * * @param int|null $works works * * @return self */ public function setWorks($works) { if (is_null($works)) { throw new \InvalidArgumentException('non-nullable works cannot be null'); } $this->container['works'] = $works; return $this; } /** * Gets filename * * @return string|null */ public function getFilename() { return $this->container['filename']; } /** * Sets filename * * @param string|null $filename filename * * @return self */ public function setFilename($filename) { if (is_null($filename)) { throw new \InvalidArgumentException('non-nullable filename cannot be null'); } $this->container['filename'] = $filename; return $this; } /** * Gets content_type * * @return string|null */ public function getContentType() { return $this->container['content_type']; } /** * Sets content_type * * @param string|null $content_type content_type * * @return self */ public function setContentType($content_type) { if (is_null($content_type)) { throw new \InvalidArgumentException('non-nullable content_type cannot be null'); } $this->container['content_type'] = $content_type; return $this; } /** * Gets size * * @return int|null */ public function getSize() { return $this->container['size']; } /** * Sets size * * @param int|null $size size * * @return self */ public function setSize($size) { if (is_null($size)) { array_push($this->openAPINullablesSetToNull, 'size'); } else { $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); $index = array_search('size', $nullablesSetToNull); if ($index !== FALSE) { unset($nullablesSetToNull[$index]); $this->setOpenAPINullablesSetToNull($nullablesSetToNull); } } $this->container['size'] = $size; return $this; } /** * Gets ready_at * * @return string|null */ public function getReadyAt() { return $this->container['ready_at']; } /** * Sets ready_at * * @param string|null $ready_at ready_at * * @return self */ public function setReadyAt($ready_at) { if (is_null($ready_at)) { array_push($this->openAPINullablesSetToNull, 'ready_at'); } else { $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); $index = array_search('ready_at', $nullablesSetToNull); if ($index !== FALSE) { unset($nullablesSetToNull[$index]); $this->setOpenAPINullablesSetToNull($nullablesSetToNull); } } $this->container['ready_at'] = $ready_at; return $this; } /** * Gets expires_at * * @return string|null */ public function getExpiresAt() { return $this->container['expires_at']; } /** * Sets expires_at * * @param string|null $expires_at expires_at * * @return self */ public function setExpiresAt($expires_at) { if (is_null($expires_at)) { array_push($this->openAPINullablesSetToNull, 'expires_at'); } else { $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); $index = array_search('expires_at', $nullablesSetToNull); if ($index !== FALSE) { unset($nullablesSetToNull[$index]); $this->setOpenAPINullablesSetToNull($nullablesSetToNull); } } $this->container['expires_at'] = $expires_at; return $this; } /** * Gets download_url * * @return string|null */ public function getDownloadUrl() { return $this->container['download_url']; } /** * Sets download_url * * @param string|null $download_url download_url * * @return self */ public function setDownloadUrl($download_url) { if (is_null($download_url)) { array_push($this->openAPINullablesSetToNull, 'download_url'); } else { $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); $index = array_search('download_url', $nullablesSetToNull); if ($index !== FALSE) { unset($nullablesSetToNull[$index]); $this->setOpenAPINullablesSetToNull($nullablesSetToNull); } } $this->container['download_url'] = $download_url; 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)); } }