<?php
/**
 * NOTE: This class is auto generated by the swagger code generator program.
 * https://github.com/swagger-api/swagger-codegen
 * Do not edit the class manually.
 */

namespace SquareConnect\Model;

use \ArrayAccess;
/**
 * CatalogCustomAttributeDefinitionSelectionConfig Class Doc Comment
 *
 * @category Class
 * @package  SquareConnect
 * @author   Square Inc.
 * @license  http://www.apache.org/licenses/LICENSE-2.0 Apache License v2
 * @link     https://squareup.com/developers
 * Note: This endpoint is in beta.
 */
class CatalogCustomAttributeDefinitionSelectionConfig implements ArrayAccess
{
    /**
      * Array of property to type mappings. Used for (de)serialization 
      * @var string[]
      */
    static $swaggerTypes = array(
        'max_allowed_selections' => 'int',
        'allowed_selections' => '\SquareConnect\Model\CatalogCustomAttributeDefinitionSelectionConfigCustomAttributeSelection[]'
    );
  
    /** 
      * Array of attributes where the key is the local name, and the value is the original name
      * @var string[] 
      */
    static $attributeMap = array(
        'max_allowed_selections' => 'max_allowed_selections',
        'allowed_selections' => 'allowed_selections'
    );
  
    /**
      * Array of attributes to setter functions (for deserialization of responses)
      * @var string[]
      */
    static $setters = array(
        'max_allowed_selections' => 'setMaxAllowedSelections',
        'allowed_selections' => 'setAllowedSelections'
    );
  
    /**
      * Array of attributes to getter functions (for serialization of requests)
      * @var string[]
      */
    static $getters = array(
        'max_allowed_selections' => 'getMaxAllowedSelections',
        'allowed_selections' => 'getAllowedSelections'
    );
  
    /**
      * $max_allowed_selections The maximum number of selections that can be set. The maximum value for this attribute is 100. May be modified, but changing the value will not affect existing custom attribute values on objects. Clients need to handle Custom Attributes with more selected values than allowed by this limit.
      * @var int
      */
    protected $max_allowed_selections;
    /**
      * $allowed_selections The set of valid `CatalogCustomAttributeSelections`. Up to a maximum of 100 selections can be defined. Can be modified.
      * @var \SquareConnect\Model\CatalogCustomAttributeDefinitionSelectionConfigCustomAttributeSelection[]
      */
    protected $allowed_selections;

    /**
     * Constructor
     * @param mixed[] $data Associated array of property value initializing the model
     */
    public function __construct(array $data = null)
    {
        if ($data != null) {
            if (isset($data["max_allowed_selections"])) {
              $this->max_allowed_selections = $data["max_allowed_selections"];
            } else {
              $this->max_allowed_selections = null;
            }
            if (isset($data["allowed_selections"])) {
              $this->allowed_selections = $data["allowed_selections"];
            } else {
              $this->allowed_selections = null;
            }
        }
    }
    /**
     * Gets max_allowed_selections
     * @return int
     */
    public function getMaxAllowedSelections()
    {
        return $this->max_allowed_selections;
    }
  
    /**
     * Sets max_allowed_selections
     * @param int $max_allowed_selections The maximum number of selections that can be set. The maximum value for this attribute is 100. May be modified, but changing the value will not affect existing custom attribute values on objects. Clients need to handle Custom Attributes with more selected values than allowed by this limit.
     * @return $this
     */
    public function setMaxAllowedSelections($max_allowed_selections)
    {
        $this->max_allowed_selections = $max_allowed_selections;
        return $this;
    }
    /**
     * Gets allowed_selections
     * @return \SquareConnect\Model\CatalogCustomAttributeDefinitionSelectionConfigCustomAttributeSelection[]
     */
    public function getAllowedSelections()
    {
        return $this->allowed_selections;
    }
  
    /**
     * Sets allowed_selections
     * @param \SquareConnect\Model\CatalogCustomAttributeDefinitionSelectionConfigCustomAttributeSelection[] $allowed_selections The set of valid `CatalogCustomAttributeSelections`. Up to a maximum of 100 selections can be defined. Can be modified.
     * @return $this
     */
    public function setAllowedSelections($allowed_selections)
    {
        $this->allowed_selections = $allowed_selections;
        return $this;
    }
    /**
     * Returns true if offset exists. False otherwise.
     * @param  integer $offset Offset 
     * @return boolean
     */
    public function offsetExists($offset)
    {
        return isset($this->$offset);
    }
  
    /**
     * Gets offset.
     * @param  integer $offset Offset 
     * @return mixed 
     */
    public function offsetGet($offset)
    {
        return $this->$offset;
    }
  
    /**
     * Sets value based on offset.
     * @param  integer $offset Offset 
     * @param  mixed   $value  Value to be set
     * @return void
     */
    public function offsetSet($offset, $value)
    {
        $this->$offset = $value;
    }
  
    /**
     * Unsets offset.
     * @param  integer $offset Offset 
     * @return void
     */
    public function offsetUnset($offset)
    {
        unset($this->$offset);
    }
  
    /**
     * Gets the string presentation of the object
     * @return string
     */
    public function __toString()
    {
        if (defined('JSON_PRETTY_PRINT')) {
            return json_encode(\SquareConnect\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT);
        } else {
            return json_encode(\SquareConnect\ObjectSerializer::sanitizeForSerialization($this));
        }
    }
}
