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

/**
 * CatalogDataProductRenderInterface Class Doc Comment
 *
 * @category Class
 * @description Represents Data Object which holds enough information to render product This information is put into part as Add To Cart or Add to Compare Data or Price Data
 * @package  Magento2
 * @author   OpenAPI Generator team
 * @link     https://openapi-generator.tech
 * @implements \ArrayAccess<TKey, TValue>
 * @template TKey int|null
 * @template TValue mixed|null
 */
class CatalogDataProductRenderInterface implements ModelInterface, ArrayAccess, \JsonSerializable
{
    public const DISCRIMINATOR = null;

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

    /**
      * Array of property to type mappings. Used for (de)serialization
      *
      * @var string[]
      */
    protected static $openAPITypes = [
        'add_to_cart_button' => '\Magento2\Model\CatalogDataProductRenderButtonInterface',
        'add_to_compare_button' => '\Magento2\Model\CatalogDataProductRenderButtonInterface',
        'price_info' => '\Magento2\Model\CatalogDataProductRenderPriceInfoInterface',
        'images' => '\Magento2\Model\CatalogDataProductRenderImageInterface[]',
        'url' => 'string',
        'id' => 'int',
        'name' => 'string',
        'type' => 'string',
        'is_salable' => 'string',
        'store_id' => 'int',
        'currency_code' => 'string',
        'extension_attributes' => '\Magento2\Model\CatalogDataProductRenderExtensionInterface'
    ];

    /**
      * 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 = [
        'add_to_cart_button' => null,
        'add_to_compare_button' => null,
        'price_info' => null,
        'images' => null,
        'url' => null,
        'id' => null,
        'name' => null,
        'type' => null,
        'is_salable' => null,
        'store_id' => null,
        'currency_code' => 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 = [
        'add_to_cart_button' => 'add_to_cart_button',
        'add_to_compare_button' => 'add_to_compare_button',
        'price_info' => 'price_info',
        'images' => 'images',
        'url' => 'url',
        'id' => 'id',
        'name' => 'name',
        'type' => 'type',
        'is_salable' => 'is_salable',
        'store_id' => 'store_id',
        'currency_code' => 'currency_code',
        'extension_attributes' => 'extension_attributes'
    ];

    /**
     * Array of attributes to setter functions (for deserialization of responses)
     *
     * @var string[]
     */
    protected static $setters = [
        'add_to_cart_button' => 'setAddToCartButton',
        'add_to_compare_button' => 'setAddToCompareButton',
        'price_info' => 'setPriceInfo',
        'images' => 'setImages',
        'url' => 'setUrl',
        'id' => 'setId',
        'name' => 'setName',
        'type' => 'setType',
        'is_salable' => 'setIsSalable',
        'store_id' => 'setStoreId',
        'currency_code' => 'setCurrencyCode',
        'extension_attributes' => 'setExtensionAttributes'
    ];

    /**
     * Array of attributes to getter functions (for serialization of requests)
     *
     * @var string[]
     */
    protected static $getters = [
        'add_to_cart_button' => 'getAddToCartButton',
        'add_to_compare_button' => 'getAddToCompareButton',
        'price_info' => 'getPriceInfo',
        'images' => 'getImages',
        'url' => 'getUrl',
        'id' => 'getId',
        'name' => 'getName',
        'type' => 'getType',
        'is_salable' => 'getIsSalable',
        'store_id' => 'getStoreId',
        'currency_code' => 'getCurrencyCode',
        '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['add_to_cart_button'] = $data['add_to_cart_button'] ?? null;
        $this->container['add_to_compare_button'] = $data['add_to_compare_button'] ?? null;
        $this->container['price_info'] = $data['price_info'] ?? null;
        $this->container['images'] = $data['images'] ?? null;
        $this->container['url'] = $data['url'] ?? null;
        $this->container['id'] = $data['id'] ?? null;
        $this->container['name'] = $data['name'] ?? null;
        $this->container['type'] = $data['type'] ?? null;
        $this->container['is_salable'] = $data['is_salable'] ?? null;
        $this->container['store_id'] = $data['store_id'] ?? null;
        $this->container['currency_code'] = $data['currency_code'] ?? 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['add_to_cart_button'] === null) {
            $invalidProperties[] = "'add_to_cart_button' can't be null";
        }
        if ($this->container['add_to_compare_button'] === null) {
            $invalidProperties[] = "'add_to_compare_button' can't be null";
        }
        if ($this->container['price_info'] === null) {
            $invalidProperties[] = "'price_info' can't be null";
        }
        if ($this->container['images'] === null) {
            $invalidProperties[] = "'images' can't be null";
        }
        if ($this->container['url'] === null) {
            $invalidProperties[] = "'url' can't be null";
        }
        if ($this->container['id'] === null) {
            $invalidProperties[] = "'id' can't be null";
        }
        if ($this->container['name'] === null) {
            $invalidProperties[] = "'name' can't be null";
        }
        if ($this->container['type'] === null) {
            $invalidProperties[] = "'type' can't be null";
        }
        if ($this->container['is_salable'] === null) {
            $invalidProperties[] = "'is_salable' can't be null";
        }
        if ($this->container['store_id'] === null) {
            $invalidProperties[] = "'store_id' can't be null";
        }
        if ($this->container['currency_code'] === null) {
            $invalidProperties[] = "'currency_code' can't be null";
        }
        if ($this->container['extension_attributes'] === null) {
            $invalidProperties[] = "'extension_attributes' 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 add_to_cart_button
     *
     * @return \Magento2\Model\CatalogDataProductRenderButtonInterface
     */
    public function getAddToCartButton()
    {
        return $this->container['add_to_cart_button'];
    }

    /**
     * Sets add_to_cart_button
     *
     * @param \Magento2\Model\CatalogDataProductRenderButtonInterface $add_to_cart_button add_to_cart_button
     *
     * @return self
     */
    public function setAddToCartButton($add_to_cart_button)
    {
        $this->container['add_to_cart_button'] = $add_to_cart_button;

        return $this;
    }

    /**
     * Gets add_to_compare_button
     *
     * @return \Magento2\Model\CatalogDataProductRenderButtonInterface
     */
    public function getAddToCompareButton()
    {
        return $this->container['add_to_compare_button'];
    }

    /**
     * Sets add_to_compare_button
     *
     * @param \Magento2\Model\CatalogDataProductRenderButtonInterface $add_to_compare_button add_to_compare_button
     *
     * @return self
     */
    public function setAddToCompareButton($add_to_compare_button)
    {
        $this->container['add_to_compare_button'] = $add_to_compare_button;

        return $this;
    }

    /**
     * Gets price_info
     *
     * @return \Magento2\Model\CatalogDataProductRenderPriceInfoInterface
     */
    public function getPriceInfo()
    {
        return $this->container['price_info'];
    }

    /**
     * Sets price_info
     *
     * @param \Magento2\Model\CatalogDataProductRenderPriceInfoInterface $price_info price_info
     *
     * @return self
     */
    public function setPriceInfo($price_info)
    {
        $this->container['price_info'] = $price_info;

        return $this;
    }

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

    /**
     * Sets images
     *
     * @param \Magento2\Model\CatalogDataProductRenderImageInterface[] $images Enough information, that needed to render image on front
     *
     * @return self
     */
    public function setImages($images)
    {
        $this->container['images'] = $images;

        return $this;
    }

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

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

        return $this;
    }

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

    /**
     * Sets id
     *
     * @param int $id Product identifier
     *
     * @return self
     */
    public function setId($id)
    {
        $this->container['id'] = $id;

        return $this;
    }

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

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

        return $this;
    }

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

    /**
     * Sets type
     *
     * @param string $type Product type. Such as bundle, grouped, simple, etc...
     *
     * @return self
     */
    public function setType($type)
    {
        $this->container['type'] = $type;

        return $this;
    }

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

    /**
     * Sets is_salable
     *
     * @param string $is_salable Information about product saleability (In Stock)
     *
     * @return self
     */
    public function setIsSalable($is_salable)
    {
        $this->container['is_salable'] = $is_salable;

        return $this;
    }

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

    /**
     * Sets store_id
     *
     * @param int $store_id Information about current store id or requested store id
     *
     * @return self
     */
    public function setStoreId($store_id)
    {
        $this->container['store_id'] = $store_id;

        return $this;
    }

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

    /**
     * Sets currency_code
     *
     * @param string $currency_code Current or desired currency code to product
     *
     * @return self
     */
    public function setCurrencyCode($currency_code)
    {
        $this->container['currency_code'] = $currency_code;

        return $this;
    }

    /**
     * Gets extension_attributes
     *
     * @return \Magento2\Model\CatalogDataProductRenderExtensionInterface
     */
    public function getExtensionAttributes()
    {
        return $this->container['extension_attributes'];
    }

    /**
     * Sets extension_attributes
     *
     * @param \Magento2\Model\CatalogDataProductRenderExtensionInterface $extension_attributes extension_attributes
     *
     * @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));
    }
}


