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

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

use \ArrayAccess;
use \Vend\ObjectSerializer;

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

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

    /**
     * Array of property to type mappings. Used for (de)serialization
     *
     * @var string[]
     */
    protected static $openAPITypes = [
        'account_code_purchase' => 'string',
        'account_code_sale' => 'string',
        'all_outlets_tax' => '\Vend\Model\ProductAddVariantPayloadAllOutletsTax',
        'attributes' => '\Vend\Model\Attribute',
        'brand_id' => 'string',
        'composite' => '\Vend\Model\Composite[]',
        'description' => 'string',
        'dimensions_unit' => 'string',
        'handle' => 'string',
        'height' => 'float',
        'images' => '\Vend\Model\ProductAddImage[]',
        'inventory' => '\Vend\Model\ProductAddInventoryPayload[]',
        'is_active' => 'bool',
        'length' => 'float',
        'loyalty_amount' => 'float',
        'name' => 'string',
        'outlet_taxes' => '\Vend\Model\ProductAddOutletTax[]',
        'price_excluding_tax' => 'float',
        'price_including_tax' => 'float',
        'product_category_id' => 'string',
        'product_codes' => '\Vend\Model\ProductCode[]',
        'product_suppliers' => '\Vend\Model\ProductSupplier[]',
        'product_type_id' => 'string',
        'sku' => 'string',
        'source' => 'string',
        'source_id' => 'string',
        'source_variant_id' => 'string',
        'supplier_code' => 'string',
        'supplier_id' => 'string',
        'supply_price' => 'float',
        'tag_ids' => 'string[]',
        'variants' => '\Vend\Model\ProductAddVariantPayload[]',
        '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 = [
        'account_code_purchase' => null,
        'account_code_sale' => null,
        'all_outlets_tax' => null,
        'attributes' => null,
        'brand_id' => 'UUID',
        'composite' => null,
        'description' => null,
        'dimensions_unit' => null,
        'handle' => null,
        'height' => null,
        'images' => null,
        'inventory' => null,
        'is_active' => null,
        'length' => null,
        'loyalty_amount' => null,
        'name' => null,
        'outlet_taxes' => null,
        'price_excluding_tax' => null,
        'price_including_tax' => null,
        'product_category_id' => 'UUID',
        'product_codes' => null,
        'product_suppliers' => null,
        'product_type_id' => 'UUID',
        'sku' => null,
        'source' => null,
        'source_id' => null,
        'source_variant_id' => null,
        'supplier_code' => null,
        'supplier_id' => 'UUID',
        'supply_price' => 'double',
        'tag_ids' => 'UUID',
        'variants' => null,
        'weight' => null,
        'weight_unit' => null,
        'width' => null
    ];

    /**
     * Array of nullable properties. Used for (de)serialization
     *
     * @var boolean[]
     */
    protected static array $openAPINullables = [
        'account_code_purchase' => false,
        'account_code_sale' => false,
        'all_outlets_tax' => false,
        'attributes' => false,
        'brand_id' => false,
        'composite' => false,
        'description' => false,
        'dimensions_unit' => false,
        'handle' => false,
        'height' => false,
        'images' => false,
        'inventory' => false,
        'is_active' => false,
        'length' => false,
        'loyalty_amount' => false,
        'name' => false,
        'outlet_taxes' => false,
        'price_excluding_tax' => false,
        'price_including_tax' => false,
        'product_category_id' => false,
        'product_codes' => false,
        'product_suppliers' => false,
        'product_type_id' => false,
        'sku' => false,
        'source' => false,
        'source_id' => false,
        'source_variant_id' => false,
        'supplier_code' => false,
        'supplier_id' => false,
        'supply_price' => false,
        'tag_ids' => false,
        'variants' => 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 = [
        'account_code_purchase' => 'account_code_purchase',
        'account_code_sale' => 'account_code_sale',
        'all_outlets_tax' => 'all_outlets_tax',
        'attributes' => 'attributes',
        'brand_id' => 'brand_id',
        'composite' => 'composite',
        'description' => 'description',
        'dimensions_unit' => 'dimensions_unit',
        'handle' => 'handle',
        'height' => 'height',
        'images' => 'images',
        'inventory' => 'inventory',
        'is_active' => 'is_active',
        'length' => 'length',
        'loyalty_amount' => 'loyalty_amount',
        'name' => 'name',
        'outlet_taxes' => 'outlet_taxes',
        'price_excluding_tax' => 'price_excluding_tax',
        'price_including_tax' => 'price_including_tax',
        'product_category_id' => 'product_category_id',
        'product_codes' => 'product_codes',
        'product_suppliers' => 'product_suppliers',
        'product_type_id' => 'product_type_id',
        'sku' => 'sku',
        'source' => 'source',
        'source_id' => 'source_id',
        'source_variant_id' => 'source_variant_id',
        'supplier_code' => 'supplier_code',
        'supplier_id' => 'supplier_id',
        'supply_price' => 'supply_price',
        'tag_ids' => 'tag_ids',
        'variants' => 'variants',
        'weight' => 'weight',
        'weight_unit' => 'weight_unit',
        'width' => 'width'
    ];

    /**
     * Array of attributes to setter functions (for deserialization of responses)
     *
     * @var string[]
     */
    protected static $setters = [
        'account_code_purchase' => 'setAccountCodePurchase',
        'account_code_sale' => 'setAccountCodeSale',
        'all_outlets_tax' => 'setAllOutletsTax',
        'attributes' => 'setAttributes',
        'brand_id' => 'setBrandId',
        'composite' => 'setComposite',
        'description' => 'setDescription',
        'dimensions_unit' => 'setDimensionsUnit',
        'handle' => 'setHandle',
        'height' => 'setHeight',
        'images' => 'setImages',
        'inventory' => 'setInventory',
        'is_active' => 'setIsActive',
        'length' => 'setLength',
        'loyalty_amount' => 'setLoyaltyAmount',
        'name' => 'setName',
        'outlet_taxes' => 'setOutletTaxes',
        'price_excluding_tax' => 'setPriceExcludingTax',
        'price_including_tax' => 'setPriceIncludingTax',
        'product_category_id' => 'setProductCategoryId',
        'product_codes' => 'setProductCodes',
        'product_suppliers' => 'setProductSuppliers',
        'product_type_id' => 'setProductTypeId',
        'sku' => 'setSku',
        'source' => 'setSource',
        'source_id' => 'setSourceId',
        'source_variant_id' => 'setSourceVariantId',
        'supplier_code' => 'setSupplierCode',
        'supplier_id' => 'setSupplierId',
        'supply_price' => 'setSupplyPrice',
        'tag_ids' => 'setTagIds',
        'variants' => 'setVariants',
        'weight' => 'setWeight',
        'weight_unit' => 'setWeightUnit',
        'width' => 'setWidth'
    ];

    /**
     * Array of attributes to getter functions (for serialization of requests)
     *
     * @var string[]
     */
    protected static $getters = [
        'account_code_purchase' => 'getAccountCodePurchase',
        'account_code_sale' => 'getAccountCodeSale',
        'all_outlets_tax' => 'getAllOutletsTax',
        'attributes' => 'getAttributes',
        'brand_id' => 'getBrandId',
        'composite' => 'getComposite',
        'description' => 'getDescription',
        'dimensions_unit' => 'getDimensionsUnit',
        'handle' => 'getHandle',
        'height' => 'getHeight',
        'images' => 'getImages',
        'inventory' => 'getInventory',
        'is_active' => 'getIsActive',
        'length' => 'getLength',
        'loyalty_amount' => 'getLoyaltyAmount',
        'name' => 'getName',
        'outlet_taxes' => 'getOutletTaxes',
        'price_excluding_tax' => 'getPriceExcludingTax',
        'price_including_tax' => 'getPriceIncludingTax',
        'product_category_id' => 'getProductCategoryId',
        'product_codes' => 'getProductCodes',
        'product_suppliers' => 'getProductSuppliers',
        'product_type_id' => 'getProductTypeId',
        'sku' => 'getSku',
        'source' => 'getSource',
        'source_id' => 'getSourceId',
        'source_variant_id' => 'getSourceVariantId',
        'supplier_code' => 'getSupplierCode',
        'supplier_id' => 'getSupplierId',
        'supply_price' => 'getSupplyPrice',
        'tag_ids' => 'getTagIds',
        'variants' => 'getVariants',
        '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('account_code_purchase', $data ?? [], null);
        $this->setIfExists('account_code_sale', $data ?? [], null);
        $this->setIfExists('all_outlets_tax', $data ?? [], null);
        $this->setIfExists('attributes', $data ?? [], null);
        $this->setIfExists('brand_id', $data ?? [], null);
        $this->setIfExists('composite', $data ?? [], null);
        $this->setIfExists('description', $data ?? [], null);
        $this->setIfExists('dimensions_unit', $data ?? [], null);
        $this->setIfExists('handle', $data ?? [], null);
        $this->setIfExists('height', $data ?? [], null);
        $this->setIfExists('images', $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('name', $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_category_id', $data ?? [], null);
        $this->setIfExists('product_codes', $data ?? [], null);
        $this->setIfExists('product_suppliers', $data ?? [], null);
        $this->setIfExists('product_type_id', $data ?? [], null);
        $this->setIfExists('sku', $data ?? [], null);
        $this->setIfExists('source', $data ?? [], null);
        $this->setIfExists('source_id', $data ?? [], null);
        $this->setIfExists('source_variant_id', $data ?? [], null);
        $this->setIfExists('supplier_code', $data ?? [], null);
        $this->setIfExists('supplier_id', $data ?? [], null);
        $this->setIfExists('supply_price', $data ?? [], null);
        $this->setIfExists('tag_ids', $data ?? [], null);
        $this->setIfExists('variants', $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)
            );
        }

        if ($this->container['name'] === null) {
            $invalidProperties[] = "'name' can't be null";
        }
        $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 account_code_purchase
     *
     * @return string|null
     */
    public function getAccountCodePurchase()
    {
        return $this->container['account_code_purchase'];
    }

    /**
     * Sets account_code_purchase
     *
     * @param string|null $account_code_purchase The code used to attribute the purchase of the product to a specific account for the Xero integration.
     *
     * @return self
     */
    public function setAccountCodePurchase($account_code_purchase)
    {
        if (is_null($account_code_purchase)) {
            throw new \InvalidArgumentException('non-nullable account_code_purchase cannot be null');
        }
        $this->container['account_code_purchase'] = $account_code_purchase;

        return $this;
    }

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

    /**
     * Sets account_code_sale
     *
     * @param string|null $account_code_sale The code used to attribute the sales of the product to a specific account for the Xero integration.
     *
     * @return self
     */
    public function setAccountCodeSale($account_code_sale)
    {
        if (is_null($account_code_sale)) {
            throw new \InvalidArgumentException('non-nullable account_code_sale cannot be null');
        }
        $this->container['account_code_sale'] = $account_code_sale;

        return $this;
    }

    /**
     * Gets all_outlets_tax
     *
     * @return \Vend\Model\ProductAddVariantPayloadAllOutletsTax|null
     */
    public function getAllOutletsTax()
    {
        return $this->container['all_outlets_tax'];
    }

    /**
     * Sets all_outlets_tax
     *
     * @param \Vend\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 attributes
     *
     * @return \Vend\Model\Attribute|null
     */
    public function getAttributes()
    {
        return $this->container['attributes'];
    }

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

        return $this;
    }

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

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

        return $this;
    }

    /**
     * Gets composite
     *
     * @return \Vend\Model\Composite[]|null
     */
    public function getComposite()
    {
        return $this->container['composite'];
    }

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

        return $this;
    }

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

    /**
     * Sets description
     *
     * @param string|null $description A detailed description of the Product. **Note** Can contain HTML.
     *
     * @return self
     */
    public function setDescription($description)
    {
        if (is_null($description)) {
            throw new \InvalidArgumentException('non-nullable description cannot be null');
        }
        $this->container['description'] = $description;

        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 handle
     *
     * @return string|null
     */
    public function getHandle()
    {
        return $this->container['handle'];
    }

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

        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 \Vend\Model\ProductAddImage[]|null
     */
    public function getImages()
    {
        return $this->container['images'];
    }

    /**
     * Sets images
     *
     * @param \Vend\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 \Vend\Model\ProductAddInventoryPayload[]|null
     */
    public function getInventory()
    {
        return $this->container['inventory'];
    }

    /**
     * Sets inventory
     *
     * @param \Vend\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 is_active
     *
     * @return bool|null
     */
    public function getIsActive()
    {
        return $this->container['is_active'];
    }

    /**
     * Sets is_active
     *
     * @param bool|null $is_active Indicated whether the Product is active.
     *
     * @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 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 loyalty_amount
     *
     * @return float|null
     */
    public function getLoyaltyAmount()
    {
        return $this->container['loyalty_amount'];
    }

    /**
     * Sets loyalty_amount
     *
     * @param float|null $loyalty_amount The amount of loyalty the customer receives buying this item.
     *
     * @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 name
     *
     * @return string
     */
    public function getName()
    {
        return $this->container['name'];
    }

    /**
     * Sets name
     *
     * @param string $name Product name. **Note:** Variants share the same name.
     *
     * @return self
     */
    public function setName($name)
    {
        if (is_null($name)) {
            throw new \InvalidArgumentException('non-nullable name cannot be null');
        }
        $this->container['name'] = $name;

        return $this;
    }

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

    /**
     * Sets outlet_taxes
     *
     * @param \Vend\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_category_id
     *
     * @return string|null
     */
    public function getProductCategoryId()
    {
        return $this->container['product_category_id'];
    }

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

        return $this;
    }

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

    /**
     * Sets product_codes
     *
     * @param \Vend\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 \Vend\Model\ProductSupplier[]|null
     */
    public function getProductSuppliers()
    {
        return $this->container['product_suppliers'];
    }

    /**
     * Sets product_suppliers
     *
     * @param \Vend\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 product_type_id
     *
     * @return string|null
     */
    public function getProductTypeId()
    {
        return $this->container['product_type_id'];
    }

    /**
     * Sets product_type_id
     *
     * @param string|null $product_type_id The product category. **Note** Product types are now product categories.
     *
     * @return self
     */
    public function setProductTypeId($product_type_id)
    {
        if (is_null($product_type_id)) {
            throw new \InvalidArgumentException('non-nullable product_type_id cannot be null');
        }
        $this->container['product_type_id'] = $product_type_id;

        return $this;
    }

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

    /**
     * Sets sku
     *
     * @param string|null $sku Product sku. **Note:** Should be unique.
     *
     * @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 source
     *
     * @return string|null
     */
    public function getSource()
    {
        return $this->container['source'];
    }

    /**
     * Sets source
     *
     * @param string|null $source Indicates the origin of the product. Can be USER, SHOPIFY.
     *
     * @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 source_id
     *
     * @return string|null
     */
    public function getSourceId()
    {
        return $this->container['source_id'];
    }

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

        return $this;
    }

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

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

        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 supplier_id
     *
     * @return string|null
     */
    public function getSupplierId()
    {
        return $this->container['supplier_id'];
    }

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

        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 tag_ids
     *
     * @return string[]|null
     */
    public function getTagIds()
    {
        return $this->container['tag_ids'];
    }

    /**
     * Sets tag_ids
     *
     * @param string[]|null $tag_ids An array of tag IDs associated with this product.
     *
     * @return self
     */
    public function setTagIds($tag_ids)
    {
        if (is_null($tag_ids)) {
            throw new \InvalidArgumentException('non-nullable tag_ids cannot be null');
        }
        $this->container['tag_ids'] = $tag_ids;

        return $this;
    }

    /**
     * Gets variants
     *
     * @return \Vend\Model\ProductAddVariantPayload[]|null
     */
    public function getVariants()
    {
        return $this->container['variants'];
    }

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

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


