<?php
/**
 * ResponseError
 *
 * PHP version 5
 *
 * @category Class
 * @package  UPS\QuantumView
 * @author   Swagger Codegen team
 * @link     https://github.com/swagger-api/swagger-codegen
 */

/**
 * Quantum View
 *
 * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
 *
 * 
 * 
 * Generated by: https://github.com/swagger-api/swagger-codegen.git
 * Swagger Codegen version: 3.0.50
 */
/**
 * 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 UPS\QuantumView\QuantumView;

use \ArrayAccess;
use \UPS\QuantumView\ObjectSerializer;

/**
 * ResponseError Class Doc Comment
 *
 * @category Class
 * @package  UPS\QuantumView
 * @author   Swagger Codegen team
 * @link     https://github.com/swagger-api/swagger-codegen
 */
class ResponseError implements ModelInterface, ArrayAccess
{
    const DISCRIMINATOR = null;

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

    /**
      * Array of property to type mappings. Used for (de)serialization
      *
      * @var string[]
      */
    protected static $swaggerTypes = [
        'error_severity' => 'string',
        'error_code' => 'string',
        'error_description' => 'string',
        'minimum_retry_seconds' => 'string',
        'error_location' => '\UPS\QuantumView\QuantumView\ErrorErrorLocation[]',
        'error_digest' => 'string[]'
    ];

    /**
      * Array of property to format mappings. Used for (de)serialization
      *
      * @var string[]
      */
    protected static $swaggerFormats = [
        'error_severity' => null,
        'error_code' => null,
        'error_description' => null,
        'minimum_retry_seconds' => null,
        'error_location' => null,
        'error_digest' => null
    ];

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

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

    /**
     * Array of attributes where the key is the local name,
     * and the value is the original name
     *
     * @var string[]
     */
    protected static $attributeMap = [
        'error_severity' => 'ErrorSeverity',
        'error_code' => 'ErrorCode',
        'error_description' => 'ErrorDescription',
        'minimum_retry_seconds' => 'MinimumRetrySeconds',
        'error_location' => 'ErrorLocation',
        'error_digest' => 'ErrorDigest'
    ];

    /**
     * Array of attributes to setter functions (for deserialization of responses)
     *
     * @var string[]
     */
    protected static $setters = [
        'error_severity' => 'setErrorSeverity',
        'error_code' => 'setErrorCode',
        'error_description' => 'setErrorDescription',
        'minimum_retry_seconds' => 'setMinimumRetrySeconds',
        'error_location' => 'setErrorLocation',
        'error_digest' => 'setErrorDigest'
    ];

    /**
     * Array of attributes to getter functions (for serialization of requests)
     *
     * @var string[]
     */
    protected static $getters = [
        'error_severity' => 'getErrorSeverity',
        'error_code' => 'getErrorCode',
        'error_description' => 'getErrorDescription',
        'minimum_retry_seconds' => 'getMinimumRetrySeconds',
        'error_location' => 'getErrorLocation',
        'error_digest' => 'getErrorDigest'
    ];

    /**
     * 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::$swaggerModelName;
    }



    /**
     * 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['error_severity'] = isset($data['error_severity']) ? $data['error_severity'] : null;
        $this->container['error_code'] = isset($data['error_code']) ? $data['error_code'] : null;
        $this->container['error_description'] = isset($data['error_description']) ? $data['error_description'] : null;
        $this->container['minimum_retry_seconds'] = isset($data['minimum_retry_seconds']) ? $data['minimum_retry_seconds'] : null;
        $this->container['error_location'] = isset($data['error_location']) ? $data['error_location'] : null;
        $this->container['error_digest'] = isset($data['error_digest']) ? $data['error_digest'] : null;
    }

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

        if ($this->container['error_location'] === null) {
            $invalidProperties[] = "'error_location' 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 error_severity
     *
     * @return string
     */
    public function getErrorSeverity()
    {
        return $this->container['error_severity'];
    }

    /**
     * Sets error_severity
     *
     * @param string $error_severity Describes the severity of the error. Required if the error is present.
     *
     * @return $this
     */
    public function setErrorSeverity($error_severity)
    {
        $this->container['error_severity'] = $error_severity;

        return $this;
    }

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

    /**
     * Sets error_code
     *
     * @param string $error_code A numeric value that describes the error. Each tool defines a range of error codes. Required if the error is present.
     *
     * @return $this
     */
    public function setErrorCode($error_code)
    {
        $this->container['error_code'] = $error_code;

        return $this;
    }

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

    /**
     * Sets error_description
     *
     * @param string $error_description Describes the error code.
     *
     * @return $this
     */
    public function setErrorDescription($error_description)
    {
        $this->container['error_description'] = $error_description;

        return $this;
    }

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

    /**
     * Sets minimum_retry_seconds
     *
     * @param string $minimum_retry_seconds Number of seconds to wait until retry. This field is populated on special conditions of the Transient Error only, as defined by the service. A number between 1 and 86400 (24 hours)
     *
     * @return $this
     */
    public function setMinimumRetrySeconds($minimum_retry_seconds)
    {
        $this->container['minimum_retry_seconds'] = $minimum_retry_seconds;

        return $this;
    }

    /**
     * Gets error_location
     *
     * @return \UPS\QuantumView\QuantumView\ErrorErrorLocation[]
     */
    public function getErrorLocation()
    {
        return $this->container['error_location'];
    }

    /**
     * Sets error_location
     *
     * @param \UPS\QuantumView\QuantumView\ErrorErrorLocation[] $error_location Identifies the element in error.  **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1.
     *
     * @return $this
     */
    public function setErrorLocation($error_location)
    {
        $this->container['error_location'] = $error_location;

        return $this;
    }

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

    /**
     * Sets error_digest
     *
     * @param string[] $error_digest The contents of the element in error.  **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1.
     *
     * @return $this
     */
    public function setErrorDigest($error_digest)
    {
        $this->container['error_digest'] = $error_digest;

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

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

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

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

    /**
     * Gets the string presentation of the object
     *
     * @return string
     */
    public function __toString()
    {
        if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print
            return json_encode(
                ObjectSerializer::sanitizeForSerialization($this),
                JSON_PRETTY_PRINT
            );
        }

        return json_encode(ObjectSerializer::sanitizeForSerialization($this));
    }
}
