<?php 
// phpcs:ignoreFile WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents
// phpcs:ignoreFile WordPress.WP.AlternativeFunctions.file_system_operations_fwrite
// phpcs:ignoreFile WordPress.WP.AlternativeFunctions.file_system_operations_fclose
// phpcs:ignoreFile WordPress.WP.AlternativeFunctions.file_system_operations_fopen
// phpcs:ignoreFile WordPress.Security.EscapeOutput.ExceptionNotEscaped            

/**
 * EpsApiMyApi2WebModelsOrderBatchOrderModel
 *
 * PHP version 7.4
 *
 * @category Class
 * @package  PPLCZCPL
 * @author   OpenAPI Generator team
 * @link     https://openapi-generator.tech
 */

/**
 * CPL
 *
 * **Changelog**    * 2024-08-22 - SPRJ-13791 - validace PRTE / PRBC externích čísel - nelze použít najednou    - /shipment/batch    * 2024-07-01 - SPRJ-13838 - přidání    - /customer/address    * 2023-11-23 - SPRJ-12703 - CPL - /shipment - timestamp    - /shipment - Rozšíření výstupu o LastUpdateDate.    * 2023-07-13 - SPRJ-11888 - přidání    - /codelist/status - číselník statusů    * 2023-07-13 - SPRJ-11953 - přidání    - /order/cancel - storno objednávky
 *
 * The version of the OpenAPI document: v1
 * Generated by: https://openapi-generator.tech
 * OpenAPI Generator version: 6.0.1
 */

/**
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 * https://openapi-generator.tech
 * Do not edit the class manually.
 */

namespace PPLCZCPL\Model;

use \ArrayAccess;
use \PPLCZCPL\ObjectSerializer;

/**
 * EpsApiMyApi2WebModelsOrderBatchOrderModel Class Doc Comment
 *
 * @category Class
 * @description Order model
 * @package  PPLCZCPL
 * @author   OpenAPI Generator team
 * @link     https://openapi-generator.tech
 * @implements \ArrayAccess<string, mixed>
 */
class EpsApiMyApi2WebModelsOrderBatchOrderModel implements ModelInterface, ArrayAccess, \JsonSerializable
{
    public const DISCRIMINATOR = null;

    /**
      * The original name of the model.
      *
      * @var string
      */
    protected static $openAPIModelName = 'Eps.Api.MyApi2.Web.Models.OrderBatch.OrderModel';

    /**
      * Array of property to type mappings. Used for (de)serialization
      *
      * @var string[]
      */
    protected static $openAPITypes = [
        'order_type' => '\PPLCZCPL\Model\EpsApiMyApi2WebModelsEnumOrderType',
        'reference_id' => 'string',
        'shipment_count' => 'int',
        'email' => 'string',
        'note' => 'string',
        'customer_reference' => 'string',
        'send_date' => '\DateTime',
        'send_time_from' => 'string',
        'send_time_to' => 'string',
        'product_type' => 'string',
        'sender' => '\PPLCZCPL\Model\EpsApiMyApi2WebModelsOrderBatchOrderModelSender',
        'recipient' => '\PPLCZCPL\Model\EpsApiMyApi2WebModelsOrderBatchOrderModelRecipient'
    ];

    /**
      * Array of property to format mappings. Used for (de)serialization
      *
      * @var string[]
      * @phpstan-var array<string, string|null>
      * @psalm-var array<string, string|null>
      */
    protected static $openAPIFormats = [
        'order_type' => null,
        'reference_id' => null,
        'shipment_count' => 'int32',
        'email' => null,
        'note' => null,
        'customer_reference' => null,
        'send_date' => 'date-time',
        'send_time_from' => 'date-span',
        'send_time_to' => 'date-span',
        'product_type' => null,
        'sender' => null,
        'recipient' => null
    ];

    /**
     * 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 attributes where the key is the local name,
     * and the value is the original name
     *
     * @var string[]
     */
    protected static $attributeMap = [
        'order_type' => 'orderType',
        'reference_id' => 'referenceId',
        'shipment_count' => 'shipmentCount',
        'email' => 'email',
        'note' => 'note',
        'customer_reference' => 'customerReference',
        'send_date' => 'sendDate',
        'send_time_from' => 'sendTimeFrom',
        'send_time_to' => 'sendTimeTo',
        'product_type' => 'productType',
        'sender' => 'sender',
        'recipient' => 'recipient'
    ];

    /**
     * Array of attributes to setter functions (for deserialization of responses)
     *
     * @var string[]
     */
    protected static $setters = [
        'order_type' => 'setOrderType',
        'reference_id' => 'setReferenceId',
        'shipment_count' => 'setShipmentCount',
        'email' => 'setEmail',
        'note' => 'setNote',
        'customer_reference' => 'setCustomerReference',
        'send_date' => 'setSendDate',
        'send_time_from' => 'setSendTimeFrom',
        'send_time_to' => 'setSendTimeTo',
        'product_type' => 'setProductType',
        'sender' => 'setSender',
        'recipient' => 'setRecipient'
    ];

    /**
     * Array of attributes to getter functions (for serialization of requests)
     *
     * @var string[]
     */
    protected static $getters = [
        'order_type' => 'getOrderType',
        'reference_id' => 'getReferenceId',
        'shipment_count' => 'getShipmentCount',
        'email' => 'getEmail',
        'note' => 'getNote',
        'customer_reference' => 'getCustomerReference',
        'send_date' => 'getSendDate',
        'send_time_from' => 'getSendTimeFrom',
        'send_time_to' => 'getSendTimeTo',
        'product_type' => 'getProductType',
        'sender' => 'getSender',
        'recipient' => 'getRecipient'
    ];

    /**
     * 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[] $data Associated array of property values
     *                      initializing the model
     */
    public function __construct(?array $data = null)
    {
        $this->container['order_type'] = $data['order_type'] ?? null;
        $this->container['reference_id'] = $data['reference_id'] ?? null;
        $this->container['shipment_count'] = $data['shipment_count'] ?? null;
        $this->container['email'] = $data['email'] ?? null;
        $this->container['note'] = $data['note'] ?? null;
        $this->container['customer_reference'] = $data['customer_reference'] ?? null;
        $this->container['send_date'] = $data['send_date'] ?? null;
        $this->container['send_time_from'] = $data['send_time_from'] ?? null;
        $this->container['send_time_to'] = $data['send_time_to'] ?? null;
        $this->container['product_type'] = $data['product_type'] ?? null;
        $this->container['sender'] = $data['sender'] ?? null;
        $this->container['recipient'] = $data['recipient'] ?? null;
    }

    /**
     * Show all the invalid properties with reasons.
     *
     * @return array invalid properties with reasons
     */
    public function listInvalidProperties()
    {
        $invalidProperties = [];

        if ($this->container['order_type'] === null) {
            $invalidProperties[] = "'order_type' can't be null";
        }
        if ($this->container['reference_id'] === null) {
            $invalidProperties[] = "'reference_id' can't be null";
        }
        if ((mb_strlen($this->container['reference_id']) > 50)) {
            $invalidProperties[] = "invalid value for 'reference_id', the character length must be smaller than or equal to 50.";
        }

        if ((mb_strlen($this->container['reference_id']) < 1)) {
            $invalidProperties[] = "invalid value for 'reference_id', the character length must be bigger than or equal to 1.";
        }

        if ($this->container['shipment_count'] === null) {
            $invalidProperties[] = "'shipment_count' can't be null";
        }
        if (($this->container['shipment_count'] > 2147483647)) {
            $invalidProperties[] = "invalid value for 'shipment_count', must be smaller than or equal to 2147483647.";
        }

        if (($this->container['shipment_count'] < 1)) {
            $invalidProperties[] = "invalid value for 'shipment_count', must be bigger than or equal to 1.";
        }

        if (!is_null($this->container['email']) && (mb_strlen($this->container['email']) > 100)) {
            $invalidProperties[] = "invalid value for 'email', the character length must be smaller than or equal to 100.";
        }

        if (!is_null($this->container['note']) && (mb_strlen($this->container['note']) > 300)) {
            $invalidProperties[] = "invalid value for 'note', the character length must be smaller than or equal to 300.";
        }

        if (!is_null($this->container['customer_reference']) && (mb_strlen($this->container['customer_reference']) > 40)) {
            $invalidProperties[] = "invalid value for 'customer_reference', the character length must be smaller than or equal to 40.";
        }

        if ($this->container['send_date'] === null) {
            $invalidProperties[] = "'send_date' can't be null";
        }
        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_type
     *
     * @return \PPLCZCPL\Model\EpsApiMyApi2WebModelsEnumOrderType
     */
    public function getOrderType()
    {
        return $this->container['order_type'];
    }

    /**
     * Sets order_type
     *
     * @param \PPLCZCPL\Model\EpsApiMyApi2WebModelsEnumOrderType $order_type order_type
     *
     * @return self
     */
    public function setOrderType($order_type)
    {
        $this->container['order_type'] = $order_type;

        return $this;
    }

    /**
     * Gets reference_id
     *
     * @return string
     */
    public function getReferenceId()
    {
        return $this->container['reference_id'];
    }

    /**
     * Sets reference_id
     *
     * @param string $reference_id Jedinečná reference!
     *
     * @return self
     */
    public function setReferenceId($reference_id)
    {
        if ((mb_strlen($reference_id) > 50)) {
            throw new \InvalidArgumentException('invalid length for $reference_id when calling EpsApiMyApi2WebModelsOrderBatchOrderModel., must be smaller than or equal to 50.');
        }
        if ((mb_strlen($reference_id) < 1)) {
            throw new \InvalidArgumentException('invalid length for $reference_id when calling EpsApiMyApi2WebModelsOrderBatchOrderModel., must be bigger than or equal to 1.');
        }

        $this->container['reference_id'] = $reference_id;

        return $this;
    }

    /**
     * Gets shipment_count
     *
     * @return int
     */
    public function getShipmentCount()
    {
        return $this->container['shipment_count'];
    }

    /**
     * Sets shipment_count
     *
     * @param int $shipment_count Počet balíků Max: 50 Délka: 2
     *
     * @return self
     */
    public function setShipmentCount($shipment_count)
    {

        if (($shipment_count > 2147483647)) {
            throw new \InvalidArgumentException('invalid value for $shipment_count when calling EpsApiMyApi2WebModelsOrderBatchOrderModel., must be smaller than or equal to 2147483647.');
        }
        if (($shipment_count < 1)) {
            throw new \InvalidArgumentException('invalid value for $shipment_count when calling EpsApiMyApi2WebModelsOrderBatchOrderModel., must be bigger than or equal to 1.');
        }

        $this->container['shipment_count'] = $shipment_count;

        return $this;
    }

    /**
     * Gets email
     *
     * @return string|null
     */
    public function getEmail()
    {
        return $this->container['email'];
    }

    /**
     * Sets email
     *
     * @param string|null $email Notifikační email pro objednavatele Délka: 2
     *
     * @return self
     */
    public function setEmail($email)
    {
        if (!is_null($email) && (mb_strlen($email) > 100)) {
            throw new \InvalidArgumentException('invalid length for $email when calling EpsApiMyApi2WebModelsOrderBatchOrderModel., must be smaller than or equal to 100.');
        }

        $this->container['email'] = $email;

        return $this;
    }

    /**
     * Gets note
     *
     * @return string|null
     */
    public function getNote()
    {
        return $this->container['note'];
    }

    /**
     * Sets note
     *
     * @param string|null $note Poznámka Délka 50
     *
     * @return self
     */
    public function setNote($note)
    {
        if (!is_null($note) && (mb_strlen($note) > 300)) {
            throw new \InvalidArgumentException('invalid length for $note when calling EpsApiMyApi2WebModelsOrderBatchOrderModel., must be smaller than or equal to 300.');
        }

        $this->container['note'] = $note;

        return $this;
    }

    /**
     * Gets customer_reference
     *
     * @return string|null
     */
    public function getCustomerReference()
    {
        return $this->container['customer_reference'];
    }

    /**
     * Sets customer_reference
     *
     * @param string|null $customer_reference Zákaznická reference. Délka: 9,2
     *
     * @return self
     */
    public function setCustomerReference($customer_reference)
    {
        if (!is_null($customer_reference) && (mb_strlen($customer_reference) > 40)) {
            throw new \InvalidArgumentException('invalid length for $customer_reference when calling EpsApiMyApi2WebModelsOrderBatchOrderModel., must be smaller than or equal to 40.');
        }

        $this->container['customer_reference'] = $customer_reference;

        return $this;
    }

    /**
     * Gets send_date
     *
     * @return \DateTime
     */
    public function getSendDate()
    {
        return $this->container['send_date'];
    }

    /**
     * Sets send_date
     *
     * @param \DateTime $send_date Datum odeslání Délka: 9,2
     *
     * @return self
     */
    public function setSendDate($send_date)
    {
        $this->container['send_date'] = $send_date;

        return $this;
    }

    /**
     * Gets send_time_from
     *
     * @return string|null
     */
    public function getSendTimeFrom()
    {
        return $this->container['send_time_from'];
    }

    /**
     * Sets send_time_from
     *
     * @param string|null $send_time_from Čas odeslání od
     *
     * @return self
     */
    public function setSendTimeFrom($send_time_from)
    {
        $this->container['send_time_from'] = $send_time_from;

        return $this;
    }

    /**
     * Gets send_time_to
     *
     * @return string|null
     */
    public function getSendTimeTo()
    {
        return $this->container['send_time_to'];
    }

    /**
     * Sets send_time_to
     *
     * @param string|null $send_time_to Čas odeslání do
     *
     * @return self
     */
    public function setSendTimeTo($send_time_to)
    {
        $this->container['send_time_to'] = $send_time_to;

        return $this;
    }

    /**
     * Gets product_type
     *
     * @return string|null
     */
    public function getProductType()
    {
        return $this->container['product_type'];
    }

    /**
     * Sets product_type
     *
     * @param string|null $product_type BUSS / IMPO Délka: 4
     *
     * @return self
     */
    public function setProductType($product_type)
    {
        $this->container['product_type'] = $product_type;

        return $this;
    }

    /**
     * Gets sender
     *
     * @return \PPLCZCPL\Model\EpsApiMyApi2WebModelsOrderBatchOrderModelSender|null
     */
    public function getSender()
    {
        return $this->container['sender'];
    }

    /**
     * Sets sender
     *
     * @param \PPLCZCPL\Model\EpsApiMyApi2WebModelsOrderBatchOrderModelSender|null $sender sender
     *
     * @return self
     */
    public function setSender($sender)
    {
        $this->container['sender'] = $sender;

        return $this;
    }

    /**
     * Gets recipient
     *
     * @return \PPLCZCPL\Model\EpsApiMyApi2WebModelsOrderBatchOrderModelRecipient|null
     */
    public function getRecipient()
    {
        return $this->container['recipient'];
    }

    /**
     * Sets recipient
     *
     * @param \PPLCZCPL\Model\EpsApiMyApi2WebModelsOrderBatchOrderModelRecipient|null $recipient recipient
     *
     * @return self
     */
    public function setRecipient($recipient)
    {
        $this->container['recipient'] = $recipient;

        return $this;
    }
    /**
     * Returns true if offset exists. False otherwise.
     *
     * @param integer $offset Offset
     *
     * @return boolean
     */
    public function offsetExists($offset): bool
    {
        return isset($this->container[$offset]);
    }

    /**
     * Gets offset.
     *
     * @param integer $offset Offset
     *
     * @return mixed|null
     */
    #[\ReturnTypeWillChange]
    public function offsetGet($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 $offset Offset
     *
     * @return void
     */
    public function offsetUnset($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 ObjectSerializerPpl::sanitizeForSerialization($this);
    }

    /**
     * Gets the string presentation of the object
     *
     * @return string
     */
    public function __toString()
    {
        return json_encode(
            ObjectSerializerPpl::sanitizeForSerialization($this),
            JSON_PRETTY_PRINT
        );
    }

    /**
     * Gets a header-safe presentation of the object
     *
     * @return string
     */
    public function toHeaderValue()
    {
        return json_encode(ObjectSerializerPpl::sanitizeForSerialization($this));
    }
}


