*/ class EOrderStatus implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ protected static $openAPIModelName = 'EOrderStatus'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ protected static $openAPITypes = [ 'order_id' => 'int', 'status_id' => 'int', 'status' => 'string', 'date_created' => '\DateTime', 'date_completed' => '\DateTime', 'date_modified' => '\DateTime', 'date_paid' => '\DateTime', 'qr_url' => 'string' ]; /** * Array of property to format mappings. Used for (de)serialization * * @var string[] * @phpstan-var array * @psalm-var array */ protected static $openAPIFormats = [ 'order_id' => 'int32', 'status_id' => 'int32', 'status' => null, 'date_created' => 'date-time', 'date_completed' => 'date-time', 'date_modified' => 'date-time', 'date_paid' => 'date-time', 'qr_url' => null ]; /** * Array of nullable properties. Used for (de)serialization * * @var boolean[] */ protected static array $openAPINullables = [ 'order_id' => false, 'status_id' => false, 'status' => true, 'date_created' => false, 'date_completed' => true, 'date_modified' => true, 'date_paid' => true, 'qr_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 = [ 'order_id' => 'orderId', 'status_id' => 'statusId', 'status' => 'status', 'date_created' => 'dateCreated', 'date_completed' => 'dateCompleted', 'date_modified' => 'dateModified', 'date_paid' => 'datePaid', 'qr_url' => 'qrUrl' ]; /** * Array of attributes to setter functions (for deserialization of responses) * * @var string[] */ protected static $setters = [ 'order_id' => 'setOrderId', 'status_id' => 'setStatusId', 'status' => 'setStatus', 'date_created' => 'setDateCreated', 'date_completed' => 'setDateCompleted', 'date_modified' => 'setDateModified', 'date_paid' => 'setDatePaid', 'qr_url' => 'setQrUrl' ]; /** * Array of attributes to getter functions (for serialization of requests) * * @var string[] */ protected static $getters = [ 'order_id' => 'getOrderId', 'status_id' => 'getStatusId', 'status' => 'getStatus', 'date_created' => 'getDateCreated', 'date_completed' => 'getDateCompleted', 'date_modified' => 'getDateModified', 'date_paid' => 'getDatePaid', 'qr_url' => 'getQrUrl' ]; /** * 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('order_id', $data ?? [], null); $this->setIfExists('status_id', $data ?? [], null); $this->setIfExists('status', $data ?? [], null); $this->setIfExists('date_created', $data ?? [], null); $this->setIfExists('date_completed', $data ?? [], null); $this->setIfExists('date_modified', $data ?? [], null); $this->setIfExists('date_paid', $data ?? [], null); $this->setIfExists('qr_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 order_id * * @return int|null */ public function getOrderId() { return $this->container['order_id']; } /** * Sets order_id * * @param int|null $order_id order_id * * @return self */ public function setOrderId($order_id) { if (is_null($order_id)) { throw new \InvalidArgumentException('non-nullable order_id cannot be null'); } $this->container['order_id'] = $order_id; return $this; } /** * Gets status_id * * @return int|null */ public function getStatusId() { return $this->container['status_id']; } /** * Sets status_id * * @param int|null $status_id status_id * * @return self */ public function setStatusId($status_id) { if (is_null($status_id)) { throw new \InvalidArgumentException('non-nullable status_id cannot be null'); } $this->container['status_id'] = $status_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)) { array_push($this->openAPINullablesSetToNull, 'status'); } else { $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); $index = array_search('status', $nullablesSetToNull); if ($index !== FALSE) { unset($nullablesSetToNull[$index]); $this->setOpenAPINullablesSetToNull($nullablesSetToNull); } } $this->container['status'] = $status; return $this; } /** * Gets date_created * * @return \DateTime|null */ public function getDateCreated() { return $this->container['date_created']; } /** * Sets date_created * * @param \DateTime|null $date_created date_created * * @return self */ public function setDateCreated($date_created) { if (is_null($date_created)) { throw new \InvalidArgumentException('non-nullable date_created cannot be null'); } $this->container['date_created'] = $date_created; return $this; } /** * Gets date_completed * * @return \DateTime|null */ public function getDateCompleted() { return $this->container['date_completed']; } /** * Sets date_completed * * @param \DateTime|null $date_completed Συμπληρώνεται από το erp όταν ολοκληρωθεί η παραγγελία * * @return self */ public function setDateCompleted($date_completed) { if (is_null($date_completed)) { array_push($this->openAPINullablesSetToNull, 'date_completed'); } else { $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); $index = array_search('date_completed', $nullablesSetToNull); if ($index !== FALSE) { unset($nullablesSetToNull[$index]); $this->setOpenAPINullablesSetToNull($nullablesSetToNull); } } $this->container['date_completed'] = $date_completed; return $this; } /** * Gets date_modified * * @return \DateTime|null */ public function getDateModified() { return $this->container['date_modified']; } /** * Sets date_modified * * @param \DateTime|null $date_modified Συμπληρώνεται από το erp όταν τροποποιηθεί η παραγγελία * * @return self */ public function setDateModified($date_modified) { if (is_null($date_modified)) { array_push($this->openAPINullablesSetToNull, 'date_modified'); } else { $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); $index = array_search('date_modified', $nullablesSetToNull); if ($index !== FALSE) { unset($nullablesSetToNull[$index]); $this->setOpenAPINullablesSetToNull($nullablesSetToNull); } } $this->container['date_modified'] = $date_modified; return $this; } /** * Gets date_paid * * @return \DateTime|null */ public function getDatePaid() { return $this->container['date_paid']; } /** * Sets date_paid * * @param \DateTime|null $date_paid Συμπληρώνεται από το eshop όταν γίνει πληρωμή με κάρτα * * @return self */ public function setDatePaid($date_paid) { if (is_null($date_paid)) { array_push($this->openAPINullablesSetToNull, 'date_paid'); } else { $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); $index = array_search('date_paid', $nullablesSetToNull); if ($index !== FALSE) { unset($nullablesSetToNull[$index]); $this->setOpenAPINullablesSetToNull($nullablesSetToNull); } } $this->container['date_paid'] = $date_paid; return $this; } /** * Gets qr_url * * @return string|null */ public function getQrUrl() { return $this->container['qr_url']; } /** * Sets qr_url * * @param string|null $qr_url Συμπληρώνεται από το erp όταν έχει εκδοθεί απόδειξη από πάροχο * * @return self */ public function setQrUrl($qr_url) { if (is_null($qr_url)) { array_push($this->openAPINullablesSetToNull, 'qr_url'); } else { $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); $index = array_search('qr_url', $nullablesSetToNull); if ($index !== FALSE) { unset($nullablesSetToNull[$index]); $this->setOpenAPINullablesSetToNull($nullablesSetToNull); } } $this->container['qr_url'] = $qr_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)); } }