<?php
/**
 * ProductAddVariantPayload
 *
 * PHP version 8.1
 *
 * @category Class
 * @package  Vend202601
 * @author   OpenAPI Generator team
 * @link     https://openapi-generator.tech
 */

/**
 * API 2026-01
 *
 * Lightspeed Retail (X-Series) API.
 *
 * The version of the OpenAPI document: 2026-01
 * Contact: x-series.api@lightspeedhq.com
 * Generated by: https://openapi-generator.tech
 * Generator version: 7.20.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 Vend202601\Model;

use \ArrayAccess;
use \Vend202601\ObjectSerializer;

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

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

    /**
      * Array of property to type mappings. Used for (de)serialization
      *
      * @var string[]
      */
    protected static $openAPITypes = [
        'all_outlets_tax' => '\Vend202601\Model\ProductAddVariantPayloadAllOutletsTax',
        'dimensions_unit' => 'string',
        'height' => 'float',
        'images' => '\Vend202601\Model\ProductAddImage[]',
        'inventory' => '\Vend202601\Model\ProductAddInventoryPayload[]',
        'length' => 'float',
        'outlet_taxes' => '\Vend202601\Model\ProductAddOutletTax[]',
        'price_excluding_tax' => 'float',
        'price_including_tax' => 'float',
        'product_codes' => '\Vend202601\Model\ProductCode[]',
        'product_suppliers' => '\Vend202601\Model\ProductSupplier[]',
        'sku' => 'string',
        'supplier_code' => 'string',
        'supply_price' => 'float',
        'variant_definitions' => '\Vend202601\Model\VariantAttribute[]',
        'weight' => 'float',
        'weight_unit' => 'string',
        'width' => 'float'
    ];

    /**
      * 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 = [
        'all_outlets_tax' => null,
        'dimensions_unit' => null,
        'height' => null,
        'images' => null,
        'inventory' => null,
        'length' => null,
        'outlet_taxes' => null,
        'price_excluding_tax' => null,
        'price_including_tax' => null,
        'product_codes' => null,
        'product_suppliers' => null,
        'sku' => null,
        'supplier_code' => null,
        'supply_price' => 'double',
        'variant_definitions' => null,
        'weight' => null,
        'weight_unit' => null,
        'width' => null
    ];

    /**
      * Array of nullable properties. Used for (de)serialization
      *
      * @var boolean[]
      */
    protected static array $openAPINullables = [
        'all_outlets_tax' => false,
        'dimensions_unit' => false,
        'height' => false,
        'images' => false,
        'inventory' => false,
        'length' => false,
        'outlet_taxes' => false,
        'price_excluding_tax' => false,
        'price_including_tax' => false,
        'product_codes' => false,
        'product_suppliers' => false,
        'sku' => false,
        'supplier_code' => false,
        'supply_price' => false,
        'variant_definitions' => false,
        'weight' => false,
        'weight_unit' => false,
        'width' => 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 = [
        'all_outlets_tax' => 'all_outlets_tax',
        'dimensions_unit' => 'dimensions_unit',
        'height' => 'height',
        'images' => 'images',
        'inventory' => 'inventory',
        'length' => 'length',
        'outlet_taxes' => 'outlet_taxes',
        'price_excluding_tax' => 'price_excluding_tax',
        'price_including_tax' => 'price_including_tax',
        'product_codes' => 'product_codes',
        'product_suppliers' => 'product_suppliers',
        'sku' => 'sku',
        'supplier_code' => 'supplier_code',
        'supply_price' => 'supply_price',
        'variant_definitions' => 'variant_definitions',
        'weight' => 'weight',
        'weight_unit' => 'weight_unit',
        'width' => 'width'
    ];

    /**
     * Array of attributes to setter functions (for deserialization of responses)
     *
     * @var string[]
     */
    protected static $setters = [
        'all_outlets_tax' => 'setAllOutletsTax',
        'dimensions_unit' => 'setDimensionsUnit',
        'height' => 'setHeight',
        'images' => 'setImages',
        'inventory' => 'setInventory',
        'length' => 'setLength',
        'outlet_taxes' => 'setOutletTaxes',
        'price_excluding_tax' => 'setPriceExcludingTax',
        'price_including_tax' => 'setPriceIncludingTax',
        'product_codes' => 'setProductCodes',
        'product_suppliers' => 'setProductSuppliers',
        'sku' => 'setSku',
        'supplier_code' => 'setSupplierCode',
        'supply_price' => 'setSupplyPrice',
        'variant_definitions' => 'setVariantDefinitions',
        'weight' => 'setWeight',
        'weight_unit' => 'setWeightUnit',
        'width' => 'setWidth'
    ];

    /**
     * Array of attributes to getter functions (for serialization of requests)
     *
     * @var string[]
     */
    protected static $getters = [
        'all_outlets_tax' => 'getAllOutletsTax',
        'dimensions_unit' => 'getDimensionsUnit',
        'height' => 'getHeight',
        'images' => 'getImages',
        'inventory' => 'getInventory',
        'length' => 'getLength',
        'outlet_taxes' => 'getOutletTaxes',
        'price_excluding_tax' => 'getPriceExcludingTax',
        'price_including_tax' => 'getPriceIncludingTax',
        'product_codes' => 'getProductCodes',
        'product_suppliers' => 'getProductSuppliers',
        'sku' => 'getSku',
        'supplier_code' => 'getSupplierCode',
        'supply_price' => 'getSupplyPrice',
        'variant_definitions' => 'getVariantDefinitions',
        'weight' => 'getWeight',
        'weight_unit' => 'getWeightUnit',
        'width' => 'getWidth'
    ];

    /**
     * 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;
    }

    public const DIMENSIONS_UNIT_IN = 'IN';
    public const DIMENSIONS_UNIT_CM = 'CM';
    public const DIMENSIONS_UNIT_MM = 'MM';
    public const DIMENSIONS_UNIT_YD = 'YD';
    public const WEIGHT_UNIT_CT = 'CT';
    public const WEIGHT_UNIT_G = 'G';
    public const WEIGHT_UNIT_OZ = 'OZ';
    public const WEIGHT_UNIT_LB = 'LB';
    public const WEIGHT_UNIT_KG = 'KG';

    /**
     * Gets allowable values of the enum
     *
     * @return string[]
     */
    public function getDimensionsUnitAllowableValues()
    {
        return [
            self::DIMENSIONS_UNIT_IN,
            self::DIMENSIONS_UNIT_CM,
            self::DIMENSIONS_UNIT_MM,
            self::DIMENSIONS_UNIT_YD,
        ];
    }

    /**
     * Gets allowable values of the enum
     *
     * @return string[]
     */
    public function getWeightUnitAllowableValues()
    {
        return [
            self::WEIGHT_UNIT_CT,
            self::WEIGHT_UNIT_G,
            self::WEIGHT_UNIT_OZ,
            self::WEIGHT_UNIT_LB,
            self::WEIGHT_UNIT_KG,
        ];
    }

    /**
     * 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('all_outlets_tax', $data ?? [], null);
        $this->setIfExists('dimensions_unit', $data ?? [], null);
        $this->setIfExists('height', $data ?? [], null);
        $this->setIfExists('images', $data ?? [], null);
        $this->setIfExists('inventory', $data ?? [], null);
        $this->setIfExists('length', $data ?? [], null);
        $this->setIfExists('outlet_taxes', $data ?? [], null);
        $this->setIfExists('price_excluding_tax', $data ?? [], null);
        $this->setIfExists('price_including_tax', $data ?? [], null);
        $this->setIfExists('product_codes', $data ?? [], null);
        $this->setIfExists('product_suppliers', $data ?? [], null);
        $this->setIfExists('sku', $data ?? [], null);
        $this->setIfExists('supplier_code', $data ?? [], null);
        $this->setIfExists('supply_price', $data ?? [], null);
        $this->setIfExists('variant_definitions', $data ?? [], null);
        $this->setIfExists('weight', $data ?? [], null);
        $this->setIfExists('weight_unit', $data ?? [], null);
        $this->setIfExists('width', $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 = [];

        $allowedValues = $this->getDimensionsUnitAllowableValues();
        if (!is_null($this->container['dimensions_unit']) && !in_array($this->container['dimensions_unit'], $allowedValues, true)) {
            $invalidProperties[] = sprintf(
                "invalid value '%s' for 'dimensions_unit', must be one of '%s'",
                $this->container['dimensions_unit'],
                implode("', '", $allowedValues)
            );
        }

        $allowedValues = $this->getWeightUnitAllowableValues();
        if (!is_null($this->container['weight_unit']) && !in_array($this->container['weight_unit'], $allowedValues, true)) {
            $invalidProperties[] = sprintf(
                "invalid value '%s' for 'weight_unit', must be one of '%s'",
                $this->container['weight_unit'],
                implode("', '", $allowedValues)
            );
        }

        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 all_outlets_tax
     *
     * @return \Vend202601\Model\ProductAddVariantPayloadAllOutletsTax|null
     */
    public function getAllOutletsTax()
    {
        return $this->container['all_outlets_tax'];
    }

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

        return $this;
    }

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

    /**
     * Sets dimensions_unit
     *
     * @param string|null $dimensions_unit Unit of measurement for product dimensions. These are used to calculate variable shipping rates for stores using Lightspeed eCom.
     *
     * @return self
     */
    public function setDimensionsUnit($dimensions_unit)
    {
        if (is_null($dimensions_unit)) {
            throw new \InvalidArgumentException('non-nullable dimensions_unit cannot be null');
        }
        $allowedValues = $this->getDimensionsUnitAllowableValues();
        if (!in_array($dimensions_unit, $allowedValues, true)) {
            throw new \InvalidArgumentException(
                sprintf(
                    "Invalid value '%s' for 'dimensions_unit', must be one of '%s'",
                    $dimensions_unit,
                    implode("', '", $allowedValues)
                )
            );
        }
        $this->container['dimensions_unit'] = $dimensions_unit;

        return $this;
    }

    /**
     * Gets height
     *
     * @return float|null
     */
    public function getHeight()
    {
        return $this->container['height'];
    }

    /**
     * Sets height
     *
     * @param float|null $height Product height. These are used to calculate variable shipping rates for stores using Lightspeed eCom.
     *
     * @return self
     */
    public function setHeight($height)
    {
        if (is_null($height)) {
            throw new \InvalidArgumentException('non-nullable height cannot be null');
        }
        $this->container['height'] = $height;

        return $this;
    }

    /**
     * Gets images
     *
     * @return \Vend202601\Model\ProductAddImage[]|null
     */
    public function getImages()
    {
        return $this->container['images'];
    }

    /**
     * Sets images
     *
     * @param \Vend202601\Model\ProductAddImage[]|null $images A list of image objects.
     *
     * @return self
     */
    public function setImages($images)
    {
        if (is_null($images)) {
            throw new \InvalidArgumentException('non-nullable images cannot be null');
        }
        $this->container['images'] = $images;

        return $this;
    }

    /**
     * Gets inventory
     *
     * @return \Vend202601\Model\ProductAddInventoryPayload[]|null
     */
    public function getInventory()
    {
        return $this->container['inventory'];
    }

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

        return $this;
    }

    /**
     * Gets length
     *
     * @return float|null
     */
    public function getLength()
    {
        return $this->container['length'];
    }

    /**
     * Sets length
     *
     * @param float|null $length Product length. These are used to calculate variable shipping rates for stores using Lightspeed eCom.
     *
     * @return self
     */
    public function setLength($length)
    {
        if (is_null($length)) {
            throw new \InvalidArgumentException('non-nullable length cannot be null');
        }
        $this->container['length'] = $length;

        return $this;
    }

    /**
     * Gets outlet_taxes
     *
     * @return \Vend202601\Model\ProductAddOutletTax[]|null
     */
    public function getOutletTaxes()
    {
        return $this->container['outlet_taxes'];
    }

    /**
     * Sets outlet_taxes
     *
     * @param \Vend202601\Model\ProductAddOutletTax[]|null $outlet_taxes Only used for tax exclusive stores.
     *
     * @return self
     */
    public function setOutletTaxes($outlet_taxes)
    {
        if (is_null($outlet_taxes)) {
            throw new \InvalidArgumentException('non-nullable outlet_taxes cannot be null');
        }
        $this->container['outlet_taxes'] = $outlet_taxes;

        return $this;
    }

    /**
     * Gets price_excluding_tax
     *
     * @return float|null
     */
    public function getPriceExcludingTax()
    {
        return $this->container['price_excluding_tax'];
    }

    /**
     * Sets price_excluding_tax
     *
     * @param float|null $price_excluding_tax The price before tax is added.
     *
     * @return self
     */
    public function setPriceExcludingTax($price_excluding_tax)
    {
        if (is_null($price_excluding_tax)) {
            throw new \InvalidArgumentException('non-nullable price_excluding_tax cannot be null');
        }
        $this->container['price_excluding_tax'] = $price_excluding_tax;

        return $this;
    }

    /**
     * Gets price_including_tax
     *
     * @return float|null
     */
    public function getPriceIncludingTax()
    {
        return $this->container['price_including_tax'];
    }

    /**
     * Sets price_including_tax
     *
     * @param float|null $price_including_tax The price including all the relevant taxes.
     *
     * @return self
     */
    public function setPriceIncludingTax($price_including_tax)
    {
        if (is_null($price_including_tax)) {
            throw new \InvalidArgumentException('non-nullable price_including_tax cannot be null');
        }
        $this->container['price_including_tax'] = $price_including_tax;

        return $this;
    }

    /**
     * Gets product_codes
     *
     * @return \Vend202601\Model\ProductCode[]|null
     */
    public function getProductCodes()
    {
        return $this->container['product_codes'];
    }

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

        return $this;
    }

    /**
     * Gets product_suppliers
     *
     * @return \Vend202601\Model\ProductSupplier[]|null
     */
    public function getProductSuppliers()
    {
        return $this->container['product_suppliers'];
    }

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

        return $this;
    }

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

    /**
     * Sets sku
     *
     * @param string|null $sku Product sku. This value should be included in the `product_codes` array. If it's not, it will be added automatically.
     *
     * @return self
     */
    public function setSku($sku)
    {
        if (is_null($sku)) {
            throw new \InvalidArgumentException('non-nullable sku cannot be null');
        }
        $this->container['sku'] = $sku;

        return $this;
    }

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

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

        return $this;
    }

    /**
     * Gets supply_price
     *
     * @return float|null
     */
    public function getSupplyPrice()
    {
        return $this->container['supply_price'];
    }

    /**
     * Sets supply_price
     *
     * @param float|null $supply_price Default supply price.
     *
     * @return self
     */
    public function setSupplyPrice($supply_price)
    {
        if (is_null($supply_price)) {
            throw new \InvalidArgumentException('non-nullable supply_price cannot be null');
        }
        $this->container['supply_price'] = $supply_price;

        return $this;
    }

    /**
     * Gets variant_definitions
     *
     * @return \Vend202601\Model\VariantAttribute[]|null
     */
    public function getVariantDefinitions()
    {
        return $this->container['variant_definitions'];
    }

    /**
     * Sets variant_definitions
     *
     * @param \Vend202601\Model\VariantAttribute[]|null $variant_definitions The attributes associated with this variant. e.g. Size.
     *
     * @return self
     */
    public function setVariantDefinitions($variant_definitions)
    {
        if (is_null($variant_definitions)) {
            throw new \InvalidArgumentException('non-nullable variant_definitions cannot be null');
        }
        $this->container['variant_definitions'] = $variant_definitions;

        return $this;
    }

    /**
     * Gets weight
     *
     * @return float|null
     */
    public function getWeight()
    {
        return $this->container['weight'];
    }

    /**
     * Sets weight
     *
     * @param float|null $weight Product weight. These are used to calculate variable shipping rates for stores using Lightspeed eCom.
     *
     * @return self
     */
    public function setWeight($weight)
    {
        if (is_null($weight)) {
            throw new \InvalidArgumentException('non-nullable weight cannot be null');
        }
        $this->container['weight'] = $weight;

        return $this;
    }

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

    /**
     * Sets weight_unit
     *
     * @param string|null $weight_unit Unit of measurement for product weight. These are used to calculate variable shipping rates for stores using Lightspeed eCom.
     *
     * @return self
     */
    public function setWeightUnit($weight_unit)
    {
        if (is_null($weight_unit)) {
            throw new \InvalidArgumentException('non-nullable weight_unit cannot be null');
        }
        $allowedValues = $this->getWeightUnitAllowableValues();
        if (!in_array($weight_unit, $allowedValues, true)) {
            throw new \InvalidArgumentException(
                sprintf(
                    "Invalid value '%s' for 'weight_unit', must be one of '%s'",
                    $weight_unit,
                    implode("', '", $allowedValues)
                )
            );
        }
        $this->container['weight_unit'] = $weight_unit;

        return $this;
    }

    /**
     * Gets width
     *
     * @return float|null
     */
    public function getWidth()
    {
        return $this->container['width'];
    }

    /**
     * Sets width
     *
     * @param float|null $width Product width. These are used to calculate variable shipping rates for stores using Lightspeed eCom.
     *
     * @return self
     */
    public function setWidth($width)
    {
        if (is_null($width)) {
            throw new \InvalidArgumentException('non-nullable width cannot be null');
        }
        $this->container['width'] = $width;

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


