<?php
/**
 * GeneralInfo
 *
 * PHP version 7.4
 *
 * @category Class
 * @package  Linnworks\OrdersV2
 * @author   OpenAPI Generator team
 * @link     https://openapi-generator.tech
 */

/**
 * Orders
 *
 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
 *
 * The version of the OpenAPI document: v1
 * Generated by: https://openapi-generator.tech
 * Generator version: 7.11.0
 */

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

namespace Linnworks\OrdersV2\Model;

use \ArrayAccess;
use \Linnworks\OrdersV2\ObjectSerializer;

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

    /**
      * The original name of the model.
      *
      * @var string
      */
    protected static $openAPIModelName = 'generalInfo';

    /**
      * Array of property to type mappings. Used for (de)serialization
      *
      * @var string[]
      */
    protected static $openAPITypes = [
        'is_cancelled' => 'bool',
        'status' => 'int',
        'status_description' => 'string',
        'label_printed' => 'bool',
        'label_error' => 'string',
        'invoice_printed' => 'bool',
        'invoice_print_error' => 'string',
        'pick_list_printed' => 'bool',
        'pick_list_print_error' => 'string',
        'notes_count' => 'int',
        'marker' => 'int',
        'identifiers' => '\Linnworks\OrdersV2\Model\Identifier[]',
        'reference_num' => 'string',
        'secondary_reference' => 'string',
        'external_reference_num' => 'string',
        'received_date' => 'string',
        'source' => 'string',
        'sub_source' => 'string',
        'despatch_by_date' => 'string',
        'scheduled_delivery' => '\Linnworks\OrdersV2\Model\GeneralInfoScheduledDelivery',
        'has_scheduled_delivery' => 'bool',
        'num_items' => 'int',
        'stock_allocation_type' => 'string'
    ];

    /**
      * 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 = [
        'is_cancelled' => null,
        'status' => null,
        'status_description' => null,
        'label_printed' => null,
        'label_error' => null,
        'invoice_printed' => null,
        'invoice_print_error' => null,
        'pick_list_printed' => null,
        'pick_list_print_error' => null,
        'notes_count' => null,
        'marker' => null,
        'identifiers' => null,
        'reference_num' => null,
        'secondary_reference' => null,
        'external_reference_num' => null,
        'received_date' => null,
        'source' => null,
        'sub_source' => null,
        'despatch_by_date' => null,
        'scheduled_delivery' => null,
        'has_scheduled_delivery' => null,
        'num_items' => null,
        'stock_allocation_type' => null
    ];

    /**
      * Array of nullable properties. Used for (de)serialization
      *
      * @var boolean[]
      */
    protected static array $openAPINullables = [
        'is_cancelled' => false,
        'status' => false,
        'status_description' => false,
        'label_printed' => false,
        'label_error' => false,
        'invoice_printed' => false,
        'invoice_print_error' => false,
        'pick_list_printed' => false,
        'pick_list_print_error' => false,
        'notes_count' => false,
        'marker' => false,
        'identifiers' => false,
        'reference_num' => false,
        'secondary_reference' => false,
        'external_reference_num' => false,
        'received_date' => false,
        'source' => false,
        'sub_source' => false,
        'despatch_by_date' => false,
        'scheduled_delivery' => false,
        'has_scheduled_delivery' => false,
        'num_items' => false,
        'stock_allocation_type' => 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 = [
        'is_cancelled' => 'IsCancelled',
        'status' => 'Status',
        'status_description' => 'StatusDescription',
        'label_printed' => 'LabelPrinted',
        'label_error' => 'LabelError',
        'invoice_printed' => 'InvoicePrinted',
        'invoice_print_error' => 'InvoicePrintError',
        'pick_list_printed' => 'PickListPrinted',
        'pick_list_print_error' => 'PickListPrintError',
        'notes_count' => 'NotesCount',
        'marker' => 'Marker',
        'identifiers' => 'Identifiers',
        'reference_num' => 'ReferenceNum',
        'secondary_reference' => 'SecondaryReference',
        'external_reference_num' => 'ExternalReferenceNum',
        'received_date' => 'ReceivedDate',
        'source' => 'Source',
        'sub_source' => 'SubSource',
        'despatch_by_date' => 'DespatchByDate',
        'scheduled_delivery' => 'ScheduledDelivery',
        'has_scheduled_delivery' => 'HasScheduledDelivery',
        'num_items' => 'NumItems',
        'stock_allocation_type' => 'StockAllocationType'
    ];

    /**
     * Array of attributes to setter functions (for deserialization of responses)
     *
     * @var string[]
     */
    protected static $setters = [
        'is_cancelled' => 'setIsCancelled',
        'status' => 'setStatus',
        'status_description' => 'setStatusDescription',
        'label_printed' => 'setLabelPrinted',
        'label_error' => 'setLabelError',
        'invoice_printed' => 'setInvoicePrinted',
        'invoice_print_error' => 'setInvoicePrintError',
        'pick_list_printed' => 'setPickListPrinted',
        'pick_list_print_error' => 'setPickListPrintError',
        'notes_count' => 'setNotesCount',
        'marker' => 'setMarker',
        'identifiers' => 'setIdentifiers',
        'reference_num' => 'setReferenceNum',
        'secondary_reference' => 'setSecondaryReference',
        'external_reference_num' => 'setExternalReferenceNum',
        'received_date' => 'setReceivedDate',
        'source' => 'setSource',
        'sub_source' => 'setSubSource',
        'despatch_by_date' => 'setDespatchByDate',
        'scheduled_delivery' => 'setScheduledDelivery',
        'has_scheduled_delivery' => 'setHasScheduledDelivery',
        'num_items' => 'setNumItems',
        'stock_allocation_type' => 'setStockAllocationType'
    ];

    /**
     * Array of attributes to getter functions (for serialization of requests)
     *
     * @var string[]
     */
    protected static $getters = [
        'is_cancelled' => 'getIsCancelled',
        'status' => 'getStatus',
        'status_description' => 'getStatusDescription',
        'label_printed' => 'getLabelPrinted',
        'label_error' => 'getLabelError',
        'invoice_printed' => 'getInvoicePrinted',
        'invoice_print_error' => 'getInvoicePrintError',
        'pick_list_printed' => 'getPickListPrinted',
        'pick_list_print_error' => 'getPickListPrintError',
        'notes_count' => 'getNotesCount',
        'marker' => 'getMarker',
        'identifiers' => 'getIdentifiers',
        'reference_num' => 'getReferenceNum',
        'secondary_reference' => 'getSecondaryReference',
        'external_reference_num' => 'getExternalReferenceNum',
        'received_date' => 'getReceivedDate',
        'source' => 'getSource',
        'sub_source' => 'getSubSource',
        'despatch_by_date' => 'getDespatchByDate',
        'scheduled_delivery' => 'getScheduledDelivery',
        'has_scheduled_delivery' => 'getHasScheduledDelivery',
        'num_items' => 'getNumItems',
        'stock_allocation_type' => 'getStockAllocationType'
    ];

    /**
     * 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('is_cancelled', $data ?? [], null);
        $this->setIfExists('status', $data ?? [], null);
        $this->setIfExists('status_description', $data ?? [], null);
        $this->setIfExists('label_printed', $data ?? [], null);
        $this->setIfExists('label_error', $data ?? [], null);
        $this->setIfExists('invoice_printed', $data ?? [], null);
        $this->setIfExists('invoice_print_error', $data ?? [], null);
        $this->setIfExists('pick_list_printed', $data ?? [], null);
        $this->setIfExists('pick_list_print_error', $data ?? [], null);
        $this->setIfExists('notes_count', $data ?? [], null);
        $this->setIfExists('marker', $data ?? [], null);
        $this->setIfExists('identifiers', $data ?? [], null);
        $this->setIfExists('reference_num', $data ?? [], null);
        $this->setIfExists('secondary_reference', $data ?? [], null);
        $this->setIfExists('external_reference_num', $data ?? [], null);
        $this->setIfExists('received_date', $data ?? [], null);
        $this->setIfExists('source', $data ?? [], null);
        $this->setIfExists('sub_source', $data ?? [], null);
        $this->setIfExists('despatch_by_date', $data ?? [], null);
        $this->setIfExists('scheduled_delivery', $data ?? [], null);
        $this->setIfExists('has_scheduled_delivery', $data ?? [], null);
        $this->setIfExists('num_items', $data ?? [], null);
        $this->setIfExists('stock_allocation_type', $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 is_cancelled
     *
     * @return bool|null
     */
    public function getIsCancelled()
    {
        return $this->container['is_cancelled'];
    }

    /**
     * Sets is_cancelled
     *
     * @param bool|null $is_cancelled is_cancelled
     *
     * @return self
     */
    public function setIsCancelled($is_cancelled)
    {
        if (is_null($is_cancelled)) {
            throw new \InvalidArgumentException('non-nullable is_cancelled cannot be null');
        }
        $this->container['is_cancelled'] = $is_cancelled;

        return $this;
    }

    /**
     * Gets status
     *
     * @return int|null
     */
    public function getStatus()
    {
        return $this->container['status'];
    }

    /**
     * Sets status
     *
     * @param int|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 status_description
     *
     * @return string|null
     */
    public function getStatusDescription()
    {
        return $this->container['status_description'];
    }

    /**
     * Sets status_description
     *
     * @param string|null $status_description status_description
     *
     * @return self
     */
    public function setStatusDescription($status_description)
    {
        if (is_null($status_description)) {
            throw new \InvalidArgumentException('non-nullable status_description cannot be null');
        }
        $this->container['status_description'] = $status_description;

        return $this;
    }

    /**
     * Gets label_printed
     *
     * @return bool|null
     */
    public function getLabelPrinted()
    {
        return $this->container['label_printed'];
    }

    /**
     * Sets label_printed
     *
     * @param bool|null $label_printed label_printed
     *
     * @return self
     */
    public function setLabelPrinted($label_printed)
    {
        if (is_null($label_printed)) {
            throw new \InvalidArgumentException('non-nullable label_printed cannot be null');
        }
        $this->container['label_printed'] = $label_printed;

        return $this;
    }

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

    /**
     * Sets label_error
     *
     * @param string|null $label_error label_error
     *
     * @return self
     */
    public function setLabelError($label_error)
    {
        if (is_null($label_error)) {
            throw new \InvalidArgumentException('non-nullable label_error cannot be null');
        }
        $this->container['label_error'] = $label_error;

        return $this;
    }

    /**
     * Gets invoice_printed
     *
     * @return bool|null
     */
    public function getInvoicePrinted()
    {
        return $this->container['invoice_printed'];
    }

    /**
     * Sets invoice_printed
     *
     * @param bool|null $invoice_printed invoice_printed
     *
     * @return self
     */
    public function setInvoicePrinted($invoice_printed)
    {
        if (is_null($invoice_printed)) {
            throw new \InvalidArgumentException('non-nullable invoice_printed cannot be null');
        }
        $this->container['invoice_printed'] = $invoice_printed;

        return $this;
    }

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

    /**
     * Sets invoice_print_error
     *
     * @param string|null $invoice_print_error invoice_print_error
     *
     * @return self
     */
    public function setInvoicePrintError($invoice_print_error)
    {
        if (is_null($invoice_print_error)) {
            throw new \InvalidArgumentException('non-nullable invoice_print_error cannot be null');
        }
        $this->container['invoice_print_error'] = $invoice_print_error;

        return $this;
    }

    /**
     * Gets pick_list_printed
     *
     * @return bool|null
     */
    public function getPickListPrinted()
    {
        return $this->container['pick_list_printed'];
    }

    /**
     * Sets pick_list_printed
     *
     * @param bool|null $pick_list_printed pick_list_printed
     *
     * @return self
     */
    public function setPickListPrinted($pick_list_printed)
    {
        if (is_null($pick_list_printed)) {
            throw new \InvalidArgumentException('non-nullable pick_list_printed cannot be null');
        }
        $this->container['pick_list_printed'] = $pick_list_printed;

        return $this;
    }

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

    /**
     * Sets pick_list_print_error
     *
     * @param string|null $pick_list_print_error pick_list_print_error
     *
     * @return self
     */
    public function setPickListPrintError($pick_list_print_error)
    {
        if (is_null($pick_list_print_error)) {
            throw new \InvalidArgumentException('non-nullable pick_list_print_error cannot be null');
        }
        $this->container['pick_list_print_error'] = $pick_list_print_error;

        return $this;
    }

    /**
     * Gets notes_count
     *
     * @return int|null
     */
    public function getNotesCount()
    {
        return $this->container['notes_count'];
    }

    /**
     * Sets notes_count
     *
     * @param int|null $notes_count notes_count
     *
     * @return self
     */
    public function setNotesCount($notes_count)
    {
        if (is_null($notes_count)) {
            throw new \InvalidArgumentException('non-nullable notes_count cannot be null');
        }
        $this->container['notes_count'] = $notes_count;

        return $this;
    }

    /**
     * Gets marker
     *
     * @return int|null
     */
    public function getMarker()
    {
        return $this->container['marker'];
    }

    /**
     * Sets marker
     *
     * @param int|null $marker marker
     *
     * @return self
     */
    public function setMarker($marker)
    {
        if (is_null($marker)) {
            throw new \InvalidArgumentException('non-nullable marker cannot be null');
        }
        $this->container['marker'] = $marker;

        return $this;
    }

    /**
     * Gets identifiers
     *
     * @return \Linnworks\OrdersV2\Model\Identifier[]|null
     */
    public function getIdentifiers()
    {
        return $this->container['identifiers'];
    }

    /**
     * Sets identifiers
     *
     * @param \Linnworks\OrdersV2\Model\Identifier[]|null $identifiers identifiers
     *
     * @return self
     */
    public function setIdentifiers($identifiers)
    {
        if (is_null($identifiers)) {
            throw new \InvalidArgumentException('non-nullable identifiers cannot be null');
        }
        $this->container['identifiers'] = $identifiers;

        return $this;
    }

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

    /**
     * Sets reference_num
     *
     * @param string|null $reference_num reference_num
     *
     * @return self
     */
    public function setReferenceNum($reference_num)
    {
        if (is_null($reference_num)) {
            throw new \InvalidArgumentException('non-nullable reference_num cannot be null');
        }
        $this->container['reference_num'] = $reference_num;

        return $this;
    }

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

    /**
     * Sets secondary_reference
     *
     * @param string|null $secondary_reference secondary_reference
     *
     * @return self
     */
    public function setSecondaryReference($secondary_reference)
    {
        if (is_null($secondary_reference)) {
            throw new \InvalidArgumentException('non-nullable secondary_reference cannot be null');
        }
        $this->container['secondary_reference'] = $secondary_reference;

        return $this;
    }

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

    /**
     * Sets external_reference_num
     *
     * @param string|null $external_reference_num external_reference_num
     *
     * @return self
     */
    public function setExternalReferenceNum($external_reference_num)
    {
        if (is_null($external_reference_num)) {
            throw new \InvalidArgumentException('non-nullable external_reference_num cannot be null');
        }
        $this->container['external_reference_num'] = $external_reference_num;

        return $this;
    }

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

    /**
     * Sets received_date
     *
     * @param string|null $received_date received_date
     *
     * @return self
     */
    public function setReceivedDate($received_date)
    {
        if (is_null($received_date)) {
            throw new \InvalidArgumentException('non-nullable received_date cannot be null');
        }
        $this->container['received_date'] = $received_date;

        return $this;
    }

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

    /**
     * Sets source
     *
     * @param string|null $source source
     *
     * @return self
     */
    public function setSource($source)
    {
        if (is_null($source)) {
            throw new \InvalidArgumentException('non-nullable source cannot be null');
        }
        $this->container['source'] = $source;

        return $this;
    }

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

    /**
     * Sets sub_source
     *
     * @param string|null $sub_source sub_source
     *
     * @return self
     */
    public function setSubSource($sub_source)
    {
        if (is_null($sub_source)) {
            throw new \InvalidArgumentException('non-nullable sub_source cannot be null');
        }
        $this->container['sub_source'] = $sub_source;

        return $this;
    }

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

    /**
     * Sets despatch_by_date
     *
     * @param string|null $despatch_by_date despatch_by_date
     *
     * @return self
     */
    public function setDespatchByDate($despatch_by_date)
    {
        if (is_null($despatch_by_date)) {
            throw new \InvalidArgumentException('non-nullable despatch_by_date cannot be null');
        }
        $this->container['despatch_by_date'] = $despatch_by_date;

        return $this;
    }

    /**
     * Gets scheduled_delivery
     *
     * @return \Linnworks\OrdersV2\Model\GeneralInfoScheduledDelivery|null
     */
    public function getScheduledDelivery()
    {
        return $this->container['scheduled_delivery'];
    }

    /**
     * Sets scheduled_delivery
     *
     * @param \Linnworks\OrdersV2\Model\GeneralInfoScheduledDelivery|null $scheduled_delivery scheduled_delivery
     *
     * @return self
     */
    public function setScheduledDelivery($scheduled_delivery)
    {
        if (is_null($scheduled_delivery)) {
            throw new \InvalidArgumentException('non-nullable scheduled_delivery cannot be null');
        }
        $this->container['scheduled_delivery'] = $scheduled_delivery;

        return $this;
    }

    /**
     * Gets has_scheduled_delivery
     *
     * @return bool|null
     */
    public function getHasScheduledDelivery()
    {
        return $this->container['has_scheduled_delivery'];
    }

    /**
     * Sets has_scheduled_delivery
     *
     * @param bool|null $has_scheduled_delivery has_scheduled_delivery
     *
     * @return self
     */
    public function setHasScheduledDelivery($has_scheduled_delivery)
    {
        if (is_null($has_scheduled_delivery)) {
            throw new \InvalidArgumentException('non-nullable has_scheduled_delivery cannot be null');
        }
        $this->container['has_scheduled_delivery'] = $has_scheduled_delivery;

        return $this;
    }

    /**
     * Gets num_items
     *
     * @return int|null
     */
    public function getNumItems()
    {
        return $this->container['num_items'];
    }

    /**
     * Sets num_items
     *
     * @param int|null $num_items num_items
     *
     * @return self
     */
    public function setNumItems($num_items)
    {
        if (is_null($num_items)) {
            throw new \InvalidArgumentException('non-nullable num_items cannot be null');
        }
        $this->container['num_items'] = $num_items;

        return $this;
    }

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

    /**
     * Sets stock_allocation_type
     *
     * @param string|null $stock_allocation_type stock_allocation_type
     *
     * @return self
     */
    public function setStockAllocationType($stock_allocation_type)
    {
        if (is_null($stock_allocation_type)) {
            throw new \InvalidArgumentException('non-nullable stock_allocation_type cannot be null');
        }
        $this->container['stock_allocation_type'] = $stock_allocation_type;

        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 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));
    }
}


