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

/**
 * linnworks_channel
 *
 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
 *
 * The version of the OpenAPI document: 1.0
 * Generated by: https://openapi-generator.tech
 * Generator version: 7.11.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 Linnworks\Channel\Model;

use \ArrayAccess;
use \Linnworks\Channel\ObjectSerializer;

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

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

    /**
      * Array of property to type mappings. Used for (de)serialization
      *
      * @var string[]
      */
    protected static $openAPITypes = [
        'group_name' => 'string',
        'config_item_id' => 'string',
        'subtitle' => 'string',
        'sub_title_sort_order' => 'int',
        'item_sort_order' => 'int',
        'description' => 'string',
        'friendly_name' => 'string',
        'must_be_specified' => 'bool',
        'expected_type' => 'string',
        'value_options' => 'string[]',
        'initial_values' => 'string[]',
        'is_multi_option' => 'bool',
        'value_from_options_list' => 'bool',
        'reg_ex_validation' => 'string',
        'reg_ex_error' => 'string',
        'is_wizard_only' => 'bool'
    ];

    /**
      * 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 = [
        'group_name' => null,
        'config_item_id' => null,
        'subtitle' => null,
        'sub_title_sort_order' => null,
        'item_sort_order' => null,
        'description' => null,
        'friendly_name' => null,
        'must_be_specified' => null,
        'expected_type' => null,
        'value_options' => null,
        'initial_values' => null,
        'is_multi_option' => null,
        'value_from_options_list' => null,
        'reg_ex_validation' => null,
        'reg_ex_error' => null,
        'is_wizard_only' => null
    ];

    /**
      * Array of nullable properties. Used for (de)serialization
      *
      * @var boolean[]
      */
    protected static array $openAPINullables = [
        'group_name' => false,
        'config_item_id' => false,
        'subtitle' => false,
        'sub_title_sort_order' => false,
        'item_sort_order' => false,
        'description' => false,
        'friendly_name' => false,
        'must_be_specified' => false,
        'expected_type' => false,
        'value_options' => false,
        'initial_values' => false,
        'is_multi_option' => false,
        'value_from_options_list' => false,
        'reg_ex_validation' => false,
        'reg_ex_error' => false,
        'is_wizard_only' => 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 = [
        'group_name' => 'GroupName',
        'config_item_id' => 'ConfigItemId',
        'subtitle' => 'Subtitle',
        'sub_title_sort_order' => 'SubTitleSortOrder',
        'item_sort_order' => 'ItemSortOrder',
        'description' => 'Description',
        'friendly_name' => 'FriendlyName',
        'must_be_specified' => 'MustBeSpecified',
        'expected_type' => 'ExpectedType',
        'value_options' => 'ValueOptions',
        'initial_values' => 'InitialValues',
        'is_multi_option' => 'IsMultiOption',
        'value_from_options_list' => 'ValueFromOptionsList',
        'reg_ex_validation' => 'RegExValidation',
        'reg_ex_error' => 'RegExError',
        'is_wizard_only' => 'IsWizardOnly'
    ];

    /**
     * Array of attributes to setter functions (for deserialization of responses)
     *
     * @var string[]
     */
    protected static $setters = [
        'group_name' => 'setGroupName',
        'config_item_id' => 'setConfigItemId',
        'subtitle' => 'setSubtitle',
        'sub_title_sort_order' => 'setSubTitleSortOrder',
        'item_sort_order' => 'setItemSortOrder',
        'description' => 'setDescription',
        'friendly_name' => 'setFriendlyName',
        'must_be_specified' => 'setMustBeSpecified',
        'expected_type' => 'setExpectedType',
        'value_options' => 'setValueOptions',
        'initial_values' => 'setInitialValues',
        'is_multi_option' => 'setIsMultiOption',
        'value_from_options_list' => 'setValueFromOptionsList',
        'reg_ex_validation' => 'setRegExValidation',
        'reg_ex_error' => 'setRegExError',
        'is_wizard_only' => 'setIsWizardOnly'
    ];

    /**
     * Array of attributes to getter functions (for serialization of requests)
     *
     * @var string[]
     */
    protected static $getters = [
        'group_name' => 'getGroupName',
        'config_item_id' => 'getConfigItemId',
        'subtitle' => 'getSubtitle',
        'sub_title_sort_order' => 'getSubTitleSortOrder',
        'item_sort_order' => 'getItemSortOrder',
        'description' => 'getDescription',
        'friendly_name' => 'getFriendlyName',
        'must_be_specified' => 'getMustBeSpecified',
        'expected_type' => 'getExpectedType',
        'value_options' => 'getValueOptions',
        'initial_values' => 'getInitialValues',
        'is_multi_option' => 'getIsMultiOption',
        'value_from_options_list' => 'getValueFromOptionsList',
        'reg_ex_validation' => 'getRegExValidation',
        'reg_ex_error' => 'getRegExError',
        'is_wizard_only' => 'getIsWizardOnly'
    ];

    /**
     * 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[]|null $data Associated array of property values
     *                      initializing the model
     */
    public function __construct(?array $data = null)
    {
        $this->setIfExists('group_name', $data ?? [], null);
        $this->setIfExists('config_item_id', $data ?? [], null);
        $this->setIfExists('subtitle', $data ?? [], null);
        $this->setIfExists('sub_title_sort_order', $data ?? [], null);
        $this->setIfExists('item_sort_order', $data ?? [], null);
        $this->setIfExists('description', $data ?? [], null);
        $this->setIfExists('friendly_name', $data ?? [], null);
        $this->setIfExists('must_be_specified', $data ?? [], null);
        $this->setIfExists('expected_type', $data ?? [], null);
        $this->setIfExists('value_options', $data ?? [], null);
        $this->setIfExists('initial_values', $data ?? [], null);
        $this->setIfExists('is_multi_option', $data ?? [], null);
        $this->setIfExists('value_from_options_list', $data ?? [], null);
        $this->setIfExists('reg_ex_validation', $data ?? [], null);
        $this->setIfExists('reg_ex_error', $data ?? [], null);
        $this->setIfExists('is_wizard_only', $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 = [];

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

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

        return $this;
    }

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

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

        return $this;
    }

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

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

        return $this;
    }

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

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

        return $this;
    }

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

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

        return $this;
    }

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

    /**
     * Sets description
     *
     * @param string|null $description description
     *
     * @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 friendly_name
     *
     * @return string|null
     */
    public function getFriendlyName()
    {
        return $this->container['friendly_name'];
    }

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

        return $this;
    }

    /**
     * Gets must_be_specified
     *
     * @return bool|null
     */
    public function getMustBeSpecified()
    {
        return $this->container['must_be_specified'];
    }

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

        return $this;
    }

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

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

        return $this;
    }

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

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

        return $this;
    }

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

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

        return $this;
    }

    /**
     * Gets is_multi_option
     *
     * @return bool|null
     */
    public function getIsMultiOption()
    {
        return $this->container['is_multi_option'];
    }

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

        return $this;
    }

    /**
     * Gets value_from_options_list
     *
     * @return bool|null
     */
    public function getValueFromOptionsList()
    {
        return $this->container['value_from_options_list'];
    }

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

        return $this;
    }

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

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

        return $this;
    }

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

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

        return $this;
    }

    /**
     * Gets is_wizard_only
     *
     * @return bool|null
     */
    public function getIsWizardOnly()
    {
        return $this->container['is_wizard_only'];
    }

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

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


