<?php
/**
 * ProductUpdate21RequestDetails
 *
 * 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;

/**
 * ProductUpdate21RequestDetails Class Doc Comment
 *
 * @category Class
 * @description Information to update to the product. For variants, this will update the fields for the individual variant product of this request only.
 * @package  Vend202601
 * @author   OpenAPI Generator team
 * @link     https://openapi-generator.tech
 * @implements \ArrayAccess<string, mixed>
 */
class ProductUpdate21RequestDetails implements ModelInterface, ArrayAccess, \JsonSerializable
{
    public const DISCRIMINATOR = null;

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

    /**
      * Array of property to type mappings. Used for (de)serialization
      *
      * @var string[]
      */
    protected static $openAPITypes = [
        'all_outlets_tax' => '\Vend202601\Model\ProductUpdate21RequestDetailsAllOutletsTax',
        'composite_components' => '\Vend202601\Model\ProductUpdate21RequestDetailsCompositeComponentsInner[]',
        'dimensions_unit' => 'string',
        'height' => 'float',
        'inventory' => '\Vend202601\Model\ProductUpdate21RequestDetailsInventoryInner[]',
        'is_active' => 'bool',
        'length' => 'float',
        'loyalty_amount' => 'float',
        'outlet_taxes' => '\Vend202601\Model\ProductUpdate21RequestDetailsOutletTaxesInner[]',
        'packaging' => '\Vend202601\Model\ProductUpdate21RequestDetailsPackagingInner[]',
        'price_excluding_tax' => 'float',
        'price_including_tax' => 'float',
        'product_codes' => '\Vend202601\Model\ProductUpdate21RequestDetailsProductCodesInner[]',
        'product_suppliers' => '\Vend202601\Model\ProductUpdate21Supplier[]',
        'variant_attribute_values' => '\Vend202601\Model\ProductUpdate21RequestDetailsVariantAttributeValuesInner[]',
        '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,
        'composite_components' => null,
        'dimensions_unit' => null,
        'height' => null,
        'inventory' => null,
        'is_active' => null,
        'length' => null,
        'loyalty_amount' => null,
        'outlet_taxes' => null,
        'packaging' => null,
        'price_excluding_tax' => null,
        'price_including_tax' => null,
        'product_codes' => null,
        'product_suppliers' => null,
        'variant_attribute_values' => 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,
        'composite_components' => false,
        'dimensions_unit' => false,
        'height' => false,
        'inventory' => false,
        'is_active' => false,
        'length' => false,
        'loyalty_amount' => false,
        'outlet_taxes' => false,
        'packaging' => false,
        'price_excluding_tax' => false,
        'price_including_tax' => false,
        'product_codes' => false,
        'product_suppliers' => false,
        'variant_attribute_values' => 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',
        'composite_components' => 'composite_components',
        'dimensions_unit' => 'dimensions_unit',
        'height' => 'height',
        'inventory' => 'inventory',
        'is_active' => 'is_active',
        'length' => 'length',
        'loyalty_amount' => 'loyalty_amount',
        'outlet_taxes' => 'outlet_taxes',
        'packaging' => 'packaging',
        'price_excluding_tax' => 'price_excluding_tax',
        'price_including_tax' => 'price_including_tax',
        'product_codes' => 'product_codes',
        'product_suppliers' => 'product_suppliers',
        'variant_attribute_values' => 'variant_attribute_values',
        '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',
        'composite_components' => 'setCompositeComponents',
        'dimensions_unit' => 'setDimensionsUnit',
        'height' => 'setHeight',
        'inventory' => 'setInventory',
        'is_active' => 'setIsActive',
        'length' => 'setLength',
        'loyalty_amount' => 'setLoyaltyAmount',
        'outlet_taxes' => 'setOutletTaxes',
        'packaging' => 'setPackaging',
        'price_excluding_tax' => 'setPriceExcludingTax',
        'price_including_tax' => 'setPriceIncludingTax',
        'product_codes' => 'setProductCodes',
        'product_suppliers' => 'setProductSuppliers',
        'variant_attribute_values' => 'setVariantAttributeValues',
        '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',
        'composite_components' => 'getCompositeComponents',
        'dimensions_unit' => 'getDimensionsUnit',
        'height' => 'getHeight',
        'inventory' => 'getInventory',
        'is_active' => 'getIsActive',
        'length' => 'getLength',
        'loyalty_amount' => 'getLoyaltyAmount',
        'outlet_taxes' => 'getOutletTaxes',
        'packaging' => 'getPackaging',
        'price_excluding_tax' => 'getPriceExcludingTax',
        'price_including_tax' => 'getPriceIncludingTax',
        'product_codes' => 'getProductCodes',
        'product_suppliers' => 'getProductSuppliers',
        'variant_attribute_values' => 'getVariantAttributeValues',
        '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('composite_components', $data ?? [], null);
        $this->setIfExists('dimensions_unit', $data ?? [], null);
        $this->setIfExists('height', $data ?? [], null);
        $this->setIfExists('inventory', $data ?? [], null);
        $this->setIfExists('is_active', $data ?? [], null);
        $this->setIfExists('length', $data ?? [], null);
        $this->setIfExists('loyalty_amount', $data ?? [], null);
        $this->setIfExists('outlet_taxes', $data ?? [], null);
        $this->setIfExists('packaging', $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('variant_attribute_values', $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\ProductUpdate21RequestDetailsAllOutletsTax|null
     */
    public function getAllOutletsTax()
    {
        return $this->container['all_outlets_tax'];
    }

    /**
     * Sets all_outlets_tax
     *
     * @param \Vend202601\Model\ProductUpdate21RequestDetailsAllOutletsTax|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 composite_components
     *
     * @return \Vend202601\Model\ProductUpdate21RequestDetailsCompositeComponentsInner[]|null
     */
    public function getCompositeComponents()
    {
        return $this->container['composite_components'];
    }

    /**
     * Sets composite_components
     *
     * @param \Vend202601\Model\ProductUpdate21RequestDetailsCompositeComponentsInner[]|null $composite_components A full list of composite components.
     *
     * @return self
     */
    public function setCompositeComponents($composite_components)
    {
        if (is_null($composite_components)) {
            throw new \InvalidArgumentException('non-nullable composite_components cannot be null');
        }
        $this->container['composite_components'] = $composite_components;

        return $this;
    }

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

    /**
     * Sets dimensions_unit
     *
     * @param string|null $dimensions_unit The unit for any height, width, or length provided.
     *
     * @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 The height of the product. If provided, dimensions_unit for this value must also be provided.
     *
     * @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 inventory
     *
     * @return \Vend202601\Model\ProductUpdate21RequestDetailsInventoryInner[]|null
     */
    public function getInventory()
    {
        return $this->container['inventory'];
    }

    /**
     * Sets inventory
     *
     * @param \Vend202601\Model\ProductUpdate21RequestDetailsInventoryInner[]|null $inventory A list of inventory outlet information to update.
     *
     * @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 is_active
     *
     * @return bool|null
     */
    public function getIsActive()
    {
        return $this->container['is_active'];
    }

    /**
     * Sets is_active
     *
     * @param bool|null $is_active True to enable Sell on POS, false to disable.
     *
     * @return self
     */
    public function setIsActive($is_active)
    {
        if (is_null($is_active)) {
            throw new \InvalidArgumentException('non-nullable is_active cannot be null');
        }
        $this->container['is_active'] = $is_active;

        return $this;
    }

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

    /**
     * Sets length
     *
     * @param float|null $length The length of the product. If provided, dimensions_unit for this value must also be provided.
     *
     * @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 loyalty_amount
     *
     * @return float|null
     */
    public function getLoyaltyAmount()
    {
        return $this->container['loyalty_amount'];
    }

    /**
     * Sets loyalty_amount
     *
     * @param float|null $loyalty_amount The custom loyalty amount. -1 to use the default loyalty amount.
     *
     * @return self
     */
    public function setLoyaltyAmount($loyalty_amount)
    {
        if (is_null($loyalty_amount)) {
            throw new \InvalidArgumentException('non-nullable loyalty_amount cannot be null');
        }
        $this->container['loyalty_amount'] = $loyalty_amount;

        return $this;
    }

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

    /**
     * Sets outlet_taxes
     *
     * @param \Vend202601\Model\ProductUpdate21RequestDetailsOutletTaxesInner[]|null $outlet_taxes A list of outlet taxes to update on a product for tax exclusive store.
     *
     * @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 packaging
     *
     * @return \Vend202601\Model\ProductUpdate21RequestDetailsPackagingInner[]|null
     */
    public function getPackaging()
    {
        return $this->container['packaging'];
    }

    /**
     * Sets packaging
     *
     * @param \Vend202601\Model\ProductUpdate21RequestDetailsPackagingInner[]|null $packaging Packaging this product belongs to.
     *
     * @return self
     */
    public function setPackaging($packaging)
    {
        if (is_null($packaging)) {
            throw new \InvalidArgumentException('non-nullable packaging cannot be null');
        }
        $this->container['packaging'] = $packaging;

        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 Price exclusive of tax. For tax exclusive store.
     *
     * @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 Price inclusive of tax. For tax inclusive store.
     *
     * @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\ProductUpdate21RequestDetailsProductCodesInner[]|null
     */
    public function getProductCodes()
    {
        return $this->container['product_codes'];
    }

    /**
     * Sets product_codes
     *
     * @param \Vend202601\Model\ProductUpdate21RequestDetailsProductCodesInner[]|null $product_codes A full list of product codes for the product. The first product code is used as the default product code.
     *
     * @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\ProductUpdate21Supplier[]|null
     */
    public function getProductSuppliers()
    {
        return $this->container['product_suppliers'];
    }

    /**
     * Sets product_suppliers
     *
     * @param \Vend202601\Model\ProductUpdate21Supplier[]|null $product_suppliers A list of suppliers and its details if the supplier needs updating. The supplier referenced by this subset must be a supplier associated to the product family.
     *
     * @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 variant_attribute_values
     *
     * @return \Vend202601\Model\ProductUpdate21RequestDetailsVariantAttributeValuesInner[]|null
     */
    public function getVariantAttributeValues()
    {
        return $this->container['variant_attribute_values'];
    }

    /**
     * Sets variant_attribute_values
     *
     * @param \Vend202601\Model\ProductUpdate21RequestDetailsVariantAttributeValuesInner[]|null $variant_attribute_values A list of values for the variant attributes defined for the product. The attributes used here must match the product family.
     *
     * @return self
     */
    public function setVariantAttributeValues($variant_attribute_values)
    {
        if (is_null($variant_attribute_values)) {
            throw new \InvalidArgumentException('non-nullable variant_attribute_values cannot be null');
        }
        $this->container['variant_attribute_values'] = $variant_attribute_values;

        return $this;
    }

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

    /**
     * Sets weight
     *
     * @param float|null $weight The weight of the product. If provided, weight_unit for this value must also be provided.
     *
     * @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 The unit for the weight provided.
     *
     * @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 The width of the product. If provided, dimensions_unit for this value must also be provided.
     *
     * @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));
    }
}


