*/ class EOrder implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; /** * The original name of the model. * * @var string */ protected static $openAPIModelName = 'EOrder'; /** * Array of property to type mappings. Used for (de)serialization * * @var string[] */ protected static $openAPITypes = [ 'order_id' => 'int', 'status_id' => 'int', 'admin_url' => 'string', 'status' => 'string', 'date_created' => '\DateTime', 'date_completed' => '\DateTime', 'date_modified' => '\DateTime', 'date_paid' => '\DateTime', 'payment_method_id' => 'int', 'payment_method' => 'string', 'shipping_method' => 'string', 'client_id' => 'int', 'notes' => 'string', 'net_amount' => 'float', 'vat_amount' => 'float', 'total_amount' => 'float', 'billing' => '\Europharmacy\EuromedicaClient\Model\Billing', 'shipping' => '\Europharmacy\EuromedicaClient\Model\Shipping', 'items' => '\Europharmacy\EuromedicaClient\Model\Items', 'fees' => '\Europharmacy\EuromedicaClient\Model\Fees', 'coupons' => '\Europharmacy\EuromedicaClient\Model\Coupons' ]; /** * 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', 'admin_url' => null, 'status' => null, 'date_created' => 'date-time', 'date_completed' => 'date-time', 'date_modified' => 'date-time', 'date_paid' => 'date-time', 'payment_method_id' => 'int32', 'payment_method' => null, 'shipping_method' => null, 'client_id' => 'int32', 'notes' => null, 'net_amount' => 'double', 'vat_amount' => 'double', 'total_amount' => 'double', 'billing' => null, 'shipping' => null, 'items' => null, 'fees' => null, 'coupons' => null ]; /** * Array of nullable properties. Used for (de)serialization * * @var boolean[] */ protected static array $openAPINullables = [ 'order_id' => false, 'status_id' => false, 'admin_url' => true, 'status' => true, 'date_created' => false, 'date_completed' => true, 'date_modified' => true, 'date_paid' => true, 'payment_method_id' => false, 'payment_method' => true, 'shipping_method' => true, 'client_id' => false, 'notes' => true, 'net_amount' => true, 'vat_amount' => true, 'total_amount' => false, 'billing' => false, 'shipping' => false, 'items' => false, 'fees' => false, 'coupons' => 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 = [ 'order_id' => 'orderId', 'status_id' => 'statusId', 'admin_url' => 'adminUrl', 'status' => 'status', 'date_created' => 'dateCreated', 'date_completed' => 'dateCompleted', 'date_modified' => 'dateModified', 'date_paid' => 'datePaid', 'payment_method_id' => 'paymentMethodId', 'payment_method' => 'paymentMethod', 'shipping_method' => 'shippingMethod', 'client_id' => 'clientId', 'notes' => 'notes', 'net_amount' => 'netAmount', 'vat_amount' => 'vatAmount', 'total_amount' => 'totalAmount', 'billing' => 'billing', 'shipping' => 'shipping', 'items' => 'items', 'fees' => 'fees', 'coupons' => 'coupons' ]; /** * Array of attributes to setter functions (for deserialization of responses) * * @var string[] */ protected static $setters = [ 'order_id' => 'setOrderId', 'status_id' => 'setStatusId', 'admin_url' => 'setAdminUrl', 'status' => 'setStatus', 'date_created' => 'setDateCreated', 'date_completed' => 'setDateCompleted', 'date_modified' => 'setDateModified', 'date_paid' => 'setDatePaid', 'payment_method_id' => 'setPaymentMethodId', 'payment_method' => 'setPaymentMethod', 'shipping_method' => 'setShippingMethod', 'client_id' => 'setClientId', 'notes' => 'setNotes', 'net_amount' => 'setNetAmount', 'vat_amount' => 'setVatAmount', 'total_amount' => 'setTotalAmount', 'billing' => 'setBilling', 'shipping' => 'setShipping', 'items' => 'setItems', 'fees' => 'setFees', 'coupons' => 'setCoupons' ]; /** * Array of attributes to getter functions (for serialization of requests) * * @var string[] */ protected static $getters = [ 'order_id' => 'getOrderId', 'status_id' => 'getStatusId', 'admin_url' => 'getAdminUrl', 'status' => 'getStatus', 'date_created' => 'getDateCreated', 'date_completed' => 'getDateCompleted', 'date_modified' => 'getDateModified', 'date_paid' => 'getDatePaid', 'payment_method_id' => 'getPaymentMethodId', 'payment_method' => 'getPaymentMethod', 'shipping_method' => 'getShippingMethod', 'client_id' => 'getClientId', 'notes' => 'getNotes', 'net_amount' => 'getNetAmount', 'vat_amount' => 'getVatAmount', 'total_amount' => 'getTotalAmount', 'billing' => 'getBilling', 'shipping' => 'getShipping', 'items' => 'getItems', 'fees' => 'getFees', 'coupons' => 'getCoupons' ]; /** * 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('admin_url', $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('payment_method_id', $data ?? [], null); $this->setIfExists('payment_method', $data ?? [], null); $this->setIfExists('shipping_method', $data ?? [], null); $this->setIfExists('client_id', $data ?? [], null); $this->setIfExists('notes', $data ?? [], null); $this->setIfExists('net_amount', $data ?? [], null); $this->setIfExists('vat_amount', $data ?? [], null); $this->setIfExists('total_amount', $data ?? [], null); $this->setIfExists('billing', $data ?? [], null); $this->setIfExists('shipping', $data ?? [], null); $this->setIfExists('items', $data ?? [], null); $this->setIfExists('fees', $data ?? [], null); $this->setIfExists('coupons', $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 = []; if (!is_null($this->container['status_id']) && ($this->container['status_id'] > 8)) { $invalidProperties[] = "invalid value for 'status_id', must be smaller than or equal to 8."; } if (!is_null($this->container['status_id']) && ($this->container['status_id'] < 1)) { $invalidProperties[] = "invalid value for 'status_id', must be bigger than or equal to 1."; } if (!is_null($this->container['payment_method_id']) && ($this->container['payment_method_id'] > 6)) { $invalidProperties[] = "invalid value for 'payment_method_id', must be smaller than or equal to 6."; } if (!is_null($this->container['payment_method_id']) && ($this->container['payment_method_id'] < 1)) { $invalidProperties[] = "invalid value for 'payment_method_id', must be bigger than or equal to 1."; } 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 ΚΑΤΑΣΤΑΣΗ ΠΑΡΑΓΓΕΛΙΑΣ {1,\"Σε διεκπεραίωση\" }, {2,\"Εκκρεμεί πληρωμή\" }, {3,\"Ολοκληρωμένη\" }, { 4,\"Αναμονή τραπεζικής πληρώμης\" }, { 5,\"Αποτυχία πληρωμής\" }, { 6,\"Ακυρωμένη\" }, { 7,\"Επιστροφή χρημάτων\" }, { 8,\"Τιμολογημένη\" } * * @return self */ public function setStatusId($status_id) { if (is_null($status_id)) { throw new \InvalidArgumentException('non-nullable status_id cannot be null'); } if (($status_id > 8)) { throw new \InvalidArgumentException('invalid value for $status_id when calling EOrder., must be smaller than or equal to 8.'); } if (($status_id < 1)) { throw new \InvalidArgumentException('invalid value for $status_id when calling EOrder., must be bigger than or equal to 1.'); } $this->container['status_id'] = $status_id; return $this; } /** * Gets admin_url * * @return string|null */ public function getAdminUrl() { return $this->container['admin_url']; } /** * Sets admin_url * * @param string|null $admin_url προαιρετικό πεδίο , διαχειριστικό eshop * * @return self */ public function setAdminUrl($admin_url) { if (is_null($admin_url)) { array_push($this->openAPINullablesSetToNull, 'admin_url'); } else { $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); $index = array_search('admin_url', $nullablesSetToNull); if ($index !== FALSE) { unset($nullablesSetToNull[$index]); $this->setOpenAPINullablesSetToNull($nullablesSetToNull); } } $this->container['admin_url'] = $admin_url; return $this; } /** * Gets status * * @return string|null */ public function getStatus() { return $this->container['status']; } /** * Sets status * * @param string|null $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 * * @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 payment_method_id * * @return int|null */ public function getPaymentMethodId() { return $this->container['payment_method_id']; } /** * Sets payment_method_id * * @param int|null $payment_method_id ΤΡΟΠΟΙ ΠΛΗΡΩΜΗΣ { 1 ,\"Aντικαταβολή\" },{ 2 ,\"Τραπεζική κατάθεση\" }, { 3 ,\"Paypal\" }, { 4 ,\"Πιστ./Χρεωσ. Κάρτα\" },{ 5 ,\"Κατάστημα\" },{ 6 ,\"Eshop\" } * * @return self */ public function setPaymentMethodId($payment_method_id) { if (is_null($payment_method_id)) { throw new \InvalidArgumentException('non-nullable payment_method_id cannot be null'); } if (($payment_method_id > 6)) { throw new \InvalidArgumentException('invalid value for $payment_method_id when calling EOrder., must be smaller than or equal to 6.'); } if (($payment_method_id < 1)) { throw new \InvalidArgumentException('invalid value for $payment_method_id when calling EOrder., must be bigger than or equal to 1.'); } $this->container['payment_method_id'] = $payment_method_id; return $this; } /** * Gets payment_method * * @return string|null */ public function getPaymentMethod() { return $this->container['payment_method']; } /** * Sets payment_method * * @param string|null $payment_method προαιρετικό πεδίο , λεκτικό του τρόπου πληρωμής * * @return self */ public function setPaymentMethod($payment_method) { if (is_null($payment_method)) { array_push($this->openAPINullablesSetToNull, 'payment_method'); } else { $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); $index = array_search('payment_method', $nullablesSetToNull); if ($index !== FALSE) { unset($nullablesSetToNull[$index]); $this->setOpenAPINullablesSetToNull($nullablesSetToNull); } } $this->container['payment_method'] = $payment_method; return $this; } /** * Gets shipping_method * * @return string|null */ public function getShippingMethod() { return $this->container['shipping_method']; } /** * Sets shipping_method * * @param string|null $shipping_method Τρόπος αποστολής * * @return self */ public function setShippingMethod($shipping_method) { if (is_null($shipping_method)) { array_push($this->openAPINullablesSetToNull, 'shipping_method'); } else { $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); $index = array_search('shipping_method', $nullablesSetToNull); if ($index !== FALSE) { unset($nullablesSetToNull[$index]); $this->setOpenAPINullablesSetToNull($nullablesSetToNull); } } $this->container['shipping_method'] = $shipping_method; return $this; } /** * Gets client_id * * @return int|null */ public function getClientId() { return $this->container['client_id']; } /** * Sets client_id * * @param int|null $client_id το id πελατη στο eshop , επισκέπτης -1 * * @return self */ public function setClientId($client_id) { if (is_null($client_id)) { throw new \InvalidArgumentException('non-nullable client_id cannot be null'); } $this->container['client_id'] = $client_id; return $this; } /** * Gets notes * * @return string|null */ public function getNotes() { return $this->container['notes']; } /** * Sets notes * * @param string|null $notes notes * * @return self */ public function setNotes($notes) { if (is_null($notes)) { array_push($this->openAPINullablesSetToNull, 'notes'); } else { $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); $index = array_search('notes', $nullablesSetToNull); if ($index !== FALSE) { unset($nullablesSetToNull[$index]); $this->setOpenAPINullablesSetToNull($nullablesSetToNull); } } $this->container['notes'] = $notes; return $this; } /** * Gets net_amount * * @return float|null */ public function getNetAmount() { return $this->container['net_amount']; } /** * Sets net_amount * * @param float|null $net_amount προαιρετικό πεδίο , Αξία παραγγελίας προ ΦΠΑ * * @return self */ public function setNetAmount($net_amount) { if (is_null($net_amount)) { array_push($this->openAPINullablesSetToNull, 'net_amount'); } else { $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); $index = array_search('net_amount', $nullablesSetToNull); if ($index !== FALSE) { unset($nullablesSetToNull[$index]); $this->setOpenAPINullablesSetToNull($nullablesSetToNull); } } $this->container['net_amount'] = $net_amount; return $this; } /** * Gets vat_amount * * @return float|null */ public function getVatAmount() { return $this->container['vat_amount']; } /** * Sets vat_amount * * @param float|null $vat_amount προαιρετικό πεδίο , Αξία ΦΠΑ * * @return self */ public function setVatAmount($vat_amount) { if (is_null($vat_amount)) { array_push($this->openAPINullablesSetToNull, 'vat_amount'); } else { $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); $index = array_search('vat_amount', $nullablesSetToNull); if ($index !== FALSE) { unset($nullablesSetToNull[$index]); $this->setOpenAPINullablesSetToNull($nullablesSetToNull); } } $this->container['vat_amount'] = $vat_amount; return $this; } /** * Gets total_amount * * @return float|null */ public function getTotalAmount() { return $this->container['total_amount']; } /** * Sets total_amount * * @param float|null $total_amount Συνολική αξία παραγγελίας * * @return self */ public function setTotalAmount($total_amount) { if (is_null($total_amount)) { throw new \InvalidArgumentException('non-nullable total_amount cannot be null'); } $this->container['total_amount'] = $total_amount; return $this; } /** * Gets billing * * @return \Europharmacy\EuromedicaClient\Model\Billing|null */ public function getBilling() { return $this->container['billing']; } /** * Sets billing * * @param \Europharmacy\EuromedicaClient\Model\Billing|null $billing billing * * @return self */ public function setBilling($billing) { if (is_null($billing)) { throw new \InvalidArgumentException('non-nullable billing cannot be null'); } $this->container['billing'] = $billing; return $this; } /** * Gets shipping * * @return \Europharmacy\EuromedicaClient\Model\Shipping|null */ public function getShipping() { return $this->container['shipping']; } /** * Sets shipping * * @param \Europharmacy\EuromedicaClient\Model\Shipping|null $shipping shipping * * @return self */ public function setShipping($shipping) { if (is_null($shipping)) { throw new \InvalidArgumentException('non-nullable shipping cannot be null'); } $this->container['shipping'] = $shipping; return $this; } /** * Gets items * * @return \Europharmacy\EuromedicaClient\Model\Items|null */ public function getItems() { return $this->container['items']; } /** * Sets items * * @param \Europharmacy\EuromedicaClient\Model\Items|null $items items * * @return self */ public function setItems($items) { if (is_null($items)) { throw new \InvalidArgumentException('non-nullable items cannot be null'); } $this->container['items'] = $items; return $this; } /** * Gets fees * * @return \Europharmacy\EuromedicaClient\Model\Fees|null */ public function getFees() { return $this->container['fees']; } /** * Sets fees * * @param \Europharmacy\EuromedicaClient\Model\Fees|null $fees fees * * @return self */ public function setFees($fees) { if (is_null($fees)) { throw new \InvalidArgumentException('non-nullable fees cannot be null'); } $this->container['fees'] = $fees; return $this; } /** * Gets coupons * * @return \Europharmacy\EuromedicaClient\Model\Coupons|null */ public function getCoupons() { return $this->container['coupons']; } /** * Sets coupons * * @param \Europharmacy\EuromedicaClient\Model\Coupons|null $coupons coupons * * @return self */ public function setCoupons($coupons) { if (is_null($coupons)) { throw new \InvalidArgumentException('non-nullable coupons cannot be null'); } $this->container['coupons'] = $coupons; 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)); } }