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

/**
 * Magento Community
 *
 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
 *
 * The version of the OpenAPI document: 2.3
 * Generated by: https://openapi-generator.tech
 * OpenAPI Generator version: 6.0.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 Magento2\Model;

use \ArrayAccess;
use \Magento2\ObjectSerializer;

/**
 * CatalogDataProductCustomOptionInterface Class Doc Comment
 *
 * @category Class
 * @description 
 * @package  Magento2
 * @author   OpenAPI Generator team
 * @link     https://openapi-generator.tech
 * @implements \ArrayAccess<TKey, TValue>
 * @template TKey int|null
 * @template TValue mixed|null
 */
class CatalogDataProductCustomOptionInterface implements ModelInterface, ArrayAccess, \JsonSerializable
{
    public const DISCRIMINATOR = null;

    /**
      * The original name of the model.
      *
      * @var string
      */
    protected static $openAPIModelName = 'catalog-data-product-custom-option-interface';

    /**
      * Array of property to type mappings. Used for (de)serialization
      *
      * @var string[]
      */
    protected static $openAPITypes = [
        'product_sku' => 'string',
        'option_id' => 'int',
        'title' => 'string',
        'type' => 'string',
        'sort_order' => 'int',
        'is_require' => 'bool',
        'price' => 'float',
        'price_type' => 'string',
        'sku' => 'string',
        'file_extension' => 'string',
        'max_characters' => 'int',
        'image_size_x' => 'int',
        'image_size_y' => 'int',
        'values' => '\Magento2\Model\CatalogDataProductCustomOptionValuesInterface[]',
        'extension_attributes' => 'object'
    ];

    /**
      * 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 = [
        'product_sku' => null,
        'option_id' => null,
        'title' => null,
        'type' => null,
        'sort_order' => null,
        'is_require' => null,
        'price' => null,
        'price_type' => null,
        'sku' => null,
        'file_extension' => null,
        'max_characters' => null,
        'image_size_x' => null,
        'image_size_y' => null,
        'values' => null,
        'extension_attributes' => null
    ];

    /**
     * Array of property to type mappings. Used for (de)serialization
     *
     * @return array
     */
    public static function openAPITypes()
    {
        return self::$openAPITypes;
    }

    /**
     * Array of property to format mappings. Used for (de)serialization
     *
     * @return array
     */
    public static function openAPIFormats()
    {
        return self::$openAPIFormats;
    }

    /**
     * Array of attributes where the key is the local name,
     * and the value is the original name
     *
     * @var string[]
     */
    protected static $attributeMap = [
        'product_sku' => 'product_sku',
        'option_id' => 'option_id',
        'title' => 'title',
        'type' => 'type',
        'sort_order' => 'sort_order',
        'is_require' => 'is_require',
        'price' => 'price',
        'price_type' => 'price_type',
        'sku' => 'sku',
        'file_extension' => 'file_extension',
        'max_characters' => 'max_characters',
        'image_size_x' => 'image_size_x',
        'image_size_y' => 'image_size_y',
        'values' => 'values',
        'extension_attributes' => 'extension_attributes'
    ];

    /**
     * Array of attributes to setter functions (for deserialization of responses)
     *
     * @var string[]
     */
    protected static $setters = [
        'product_sku' => 'setProductSku',
        'option_id' => 'setOptionId',
        'title' => 'setTitle',
        'type' => 'setType',
        'sort_order' => 'setSortOrder',
        'is_require' => 'setIsRequire',
        'price' => 'setPrice',
        'price_type' => 'setPriceType',
        'sku' => 'setSku',
        'file_extension' => 'setFileExtension',
        'max_characters' => 'setMaxCharacters',
        'image_size_x' => 'setImageSizeX',
        'image_size_y' => 'setImageSizeY',
        'values' => 'setValues',
        'extension_attributes' => 'setExtensionAttributes'
    ];

    /**
     * Array of attributes to getter functions (for serialization of requests)
     *
     * @var string[]
     */
    protected static $getters = [
        'product_sku' => 'getProductSku',
        'option_id' => 'getOptionId',
        'title' => 'getTitle',
        'type' => 'getType',
        'sort_order' => 'getSortOrder',
        'is_require' => 'getIsRequire',
        'price' => 'getPrice',
        'price_type' => 'getPriceType',
        'sku' => 'getSku',
        'file_extension' => 'getFileExtension',
        'max_characters' => 'getMaxCharacters',
        'image_size_x' => 'getImageSizeX',
        'image_size_y' => 'getImageSizeY',
        'values' => 'getValues',
        'extension_attributes' => 'getExtensionAttributes'
    ];

    /**
     * Array of attributes where the key is the local name,
     * and the value is the original name
     *
     * @return array
     */
    public static function attributeMap()
    {
        return self::$attributeMap;
    }

    /**
     * Array of attributes to setter functions (for deserialization of responses)
     *
     * @return array
     */
    public static function setters()
    {
        return self::$setters;
    }

    /**
     * Array of attributes to getter functions (for serialization of requests)
     *
     * @return array
     */
    public static function getters()
    {
        return self::$getters;
    }

    /**
     * The original name of the model.
     *
     * @return string
     */
    public function getModelName()
    {
        return self::$openAPIModelName;
    }


    /**
     * Associative array for storing property values
     *
     * @var mixed[]
     */
    protected $container = [];

    /**
     * Constructor
     *
     * @param mixed[] $data Associated array of property values
     *                      initializing the model
     */
    public function __construct(array $data = null)
    {
        $this->container['product_sku'] = $data['product_sku'] ?? null;
        $this->container['option_id'] = $data['option_id'] ?? null;
        $this->container['title'] = $data['title'] ?? null;
        $this->container['type'] = $data['type'] ?? null;
        $this->container['sort_order'] = $data['sort_order'] ?? null;
        $this->container['is_require'] = $data['is_require'] ?? null;
        $this->container['price'] = $data['price'] ?? null;
        $this->container['price_type'] = $data['price_type'] ?? null;
        $this->container['sku'] = $data['sku'] ?? null;
        $this->container['file_extension'] = $data['file_extension'] ?? null;
        $this->container['max_characters'] = $data['max_characters'] ?? null;
        $this->container['image_size_x'] = $data['image_size_x'] ?? null;
        $this->container['image_size_y'] = $data['image_size_y'] ?? null;
        $this->container['values'] = $data['values'] ?? null;
        $this->container['extension_attributes'] = $data['extension_attributes'] ?? null;
    }

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

        if ($this->container['product_sku'] === null) {
            $invalidProperties[] = "'product_sku' can't be null";
        }
        if ($this->container['title'] === null) {
            $invalidProperties[] = "'title' can't be null";
        }
        if ($this->container['type'] === null) {
            $invalidProperties[] = "'type' can't be null";
        }
        if ($this->container['sort_order'] === null) {
            $invalidProperties[] = "'sort_order' can't be null";
        }
        if ($this->container['is_require'] === null) {
            $invalidProperties[] = "'is_require' can't be null";
        }
        return $invalidProperties;
    }

    /**
     * Validate all the properties in the model
     * return true if all passed
     *
     * @return bool True if all properties are valid
     */
    public function valid()
    {
        return count($this->listInvalidProperties()) === 0;
    }


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

    /**
     * Sets product_sku
     *
     * @param string $product_sku Product SKU
     *
     * @return self
     */
    public function setProductSku($product_sku)
    {
        $this->container['product_sku'] = $product_sku;

        return $this;
    }

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

    /**
     * Sets option_id
     *
     * @param int|null $option_id Option id
     *
     * @return self
     */
    public function setOptionId($option_id)
    {
        $this->container['option_id'] = $option_id;

        return $this;
    }

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

    /**
     * Sets title
     *
     * @param string $title Option title
     *
     * @return self
     */
    public function setTitle($title)
    {
        $this->container['title'] = $title;

        return $this;
    }

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

    /**
     * Sets type
     *
     * @param string $type Option type
     *
     * @return self
     */
    public function setType($type)
    {
        $this->container['type'] = $type;

        return $this;
    }

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

    /**
     * Sets sort_order
     *
     * @param int $sort_order Sort order
     *
     * @return self
     */
    public function setSortOrder($sort_order)
    {
        $this->container['sort_order'] = $sort_order;

        return $this;
    }

    /**
     * Gets is_require
     *
     * @return bool
     */
    public function getIsRequire()
    {
        return $this->container['is_require'];
    }

    /**
     * Sets is_require
     *
     * @param bool $is_require Is require
     *
     * @return self
     */
    public function setIsRequire($is_require)
    {
        $this->container['is_require'] = $is_require;

        return $this;
    }

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

    /**
     * Sets price
     *
     * @param float|null $price Price
     *
     * @return self
     */
    public function setPrice($price)
    {
        $this->container['price'] = $price;

        return $this;
    }

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

    /**
     * Sets price_type
     *
     * @param string|null $price_type Price type
     *
     * @return self
     */
    public function setPriceType($price_type)
    {
        $this->container['price_type'] = $price_type;

        return $this;
    }

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

    /**
     * Sets sku
     *
     * @param string|null $sku Sku
     *
     * @return self
     */
    public function setSku($sku)
    {
        $this->container['sku'] = $sku;

        return $this;
    }

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

    /**
     * Sets file_extension
     *
     * @param string|null $file_extension file_extension
     *
     * @return self
     */
    public function setFileExtension($file_extension)
    {
        $this->container['file_extension'] = $file_extension;

        return $this;
    }

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

    /**
     * Sets max_characters
     *
     * @param int|null $max_characters max_characters
     *
     * @return self
     */
    public function setMaxCharacters($max_characters)
    {
        $this->container['max_characters'] = $max_characters;

        return $this;
    }

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

    /**
     * Sets image_size_x
     *
     * @param int|null $image_size_x image_size_x
     *
     * @return self
     */
    public function setImageSizeX($image_size_x)
    {
        $this->container['image_size_x'] = $image_size_x;

        return $this;
    }

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

    /**
     * Sets image_size_y
     *
     * @param int|null $image_size_y image_size_y
     *
     * @return self
     */
    public function setImageSizeY($image_size_y)
    {
        $this->container['image_size_y'] = $image_size_y;

        return $this;
    }

    /**
     * Gets values
     *
     * @return \Magento2\Model\CatalogDataProductCustomOptionValuesInterface[]|null
     */
    public function getValues()
    {
        return $this->container['values'];
    }

    /**
     * Sets values
     *
     * @param \Magento2\Model\CatalogDataProductCustomOptionValuesInterface[]|null $values values
     *
     * @return self
     */
    public function setValues($values)
    {
        $this->container['values'] = $values;

        return $this;
    }

    /**
     * Gets extension_attributes
     *
     * @return object|null
     */
    public function getExtensionAttributes()
    {
        return $this->container['extension_attributes'];
    }

    /**
     * Sets extension_attributes
     *
     * @param object|null $extension_attributes ExtensionInterface class for @see \\Magento\\Catalog\\Api\\Data\\ProductCustomOptionInterface
     *
     * @return self
     */
    public function setExtensionAttributes($extension_attributes)
    {
        $this->container['extension_attributes'] = $extension_attributes;

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

    /**
     * Gets offset.
     *
     * @param integer $offset Offset
     *
     * @return mixed|null
     */
    #[\ReturnTypeWillChange]
    public function offsetGet($offset)
    {
        return $this->container[$offset] ?? null;
    }

    /**
     * Sets value based on offset.
     *
     * @param int|null $offset Offset
     * @param mixed    $value  Value to be set
     *
     * @return void
     */
    public function offsetSet($offset, $value): void
    {
        if (is_null($offset)) {
            $this->container[] = $value;
        } else {
            $this->container[$offset] = $value;
        }
    }

    /**
     * Unsets offset.
     *
     * @param integer $offset Offset
     *
     * @return void
     */
    public function offsetUnset($offset): void
    {
        unset($this->container[$offset]);
    }

    /**
     * Serializes the object to a value that can be serialized natively by json_encode().
     * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
     *
     * @return mixed Returns data which can be serialized by json_encode(), which is a value
     * of any type other than a resource.
     */
    #[\ReturnTypeWillChange]
    public function jsonSerialize()
    {
       return ObjectSerializer::sanitizeForSerialization($this);
    }

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

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


