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

/**
 * Domestic Prices
 *
 * Contact Us: [USPS API Support](https://emailus.usps.com/s/usps-APIs) | [Terms of Service](https://about.usps.com/termsofuse.htm)  The prices API can be used to calculate postage rates for domestic packages:  * Base postage based on a set of given package characteristics * Base postage based on a given Stock Keeping Units (SKUs) * Extra service postage based on a given extra service code and mail class * A list of eligible products for a given set of package characteristics  For specifications such as package and letter dimensions, delivery information, etc., please refer to the [Domestic Mail Manual (DMM)](https://pe.usps.com/DMM300).  For a list of published prices please refer to the [USPS&#174; Price List](https://pe.usps.com/text/dmm300/Notice123.htm).  To discover the rate ingredients for this API, please visit [Publication 205](https://postalpro.usps.com/pub205).    **Authentication, Authorization and Access Control**      Client applications are given authorized access to protected information resources. Authorization is accomplished via the USPS&#174; Customer Onboarding Platform, where Customer Registration users may grant applications access to their protected business information. All client applications must go through this onboarding process. Any Customer Registration user wishing to share their protected business information with client application(s) may also grant authorized access.  The OAuth2, version 3 (/v3), API is based on this authorization grant and must be used to get tokens for all V3 APIs. * The resulting OAuth2 access token is to be placed in the **Authorization** header, using the **Bearer** authentication scheme. * All version 3 APIs validate access to protected information resources and will respond with a *401* HTTP status, *Unauthorized* reason, when the client application has not been authorized to access the given information resource.  The following APIs may include payment account or permit identification used to get contract rates.  If all mail classes are needed, please use the /total-rates/search endpoint.
 *
 * OpenAPI spec version: 3.4.27
 * 
 * Generated by: https://github.com/swagger-api/swagger-codegen.git
 * Swagger Codegen version: 3.0.71
 */
/**
 * 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 USPS\DomesticPrices\Model;
use \USPS\DomesticPrices\ObjectSerializer;

/**
 * TotalRatesQuery Class Doc Comment
 *
 * @category Class
 * @description Search parameters for base rate and extra service rate.
 * @package  USPS\DomesticPrices
 * @author   Swagger Codegen team
 * @link     https://github.com/swagger-api/swagger-codegen
 */
class TotalRatesQuery extends RateListQuery 
{
    const DISCRIMINATOR = null;

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

    /**
      * Array of property to type mappings. Used for (de)serialization
      *
      * @var string[]
      */
    protected static $swaggerTypes = [
        'item_value' => 'double',
        'extra_services' => '\USPS\DomesticPrices\Model\TotalRatesExtraServices'
    ];

    /**
      * Array of property to format mappings. Used for (de)serialization
      *
      * @var string[]
      */
    protected static $swaggerFormats = [
        'item_value' => 'double',
        'extra_services' => null
    ];

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

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

    /**
     * Array of attributes where the key is the local name,
     * and the value is the original name
     *
     * @var string[]
     */
    protected static $attributeMap = [
        'item_value' => 'itemValue',
        'extra_services' => 'extraServices'
    ];

    /**
     * Array of attributes to setter functions (for deserialization of responses)
     *
     * @var string[]
     */
    protected static $setters = [
        'item_value' => 'setItemValue',
        'extra_services' => 'setExtraServices'
    ];

    /**
     * Array of attributes to getter functions (for serialization of requests)
     *
     * @var string[]
     */
    protected static $getters = [
        'item_value' => 'getItemValue',
        'extra_services' => 'getExtraServices'
    ];

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

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

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

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




    /**
     * Constructor
     *
     * @param mixed[] $data Associated array of property values
     *                      initializing the model
     */
    public function __construct(array $data = null)
    {
        parent::__construct($data);

        $this->container['item_value'] = isset($data['item_value']) ? $data['item_value'] : null;
        $this->container['extra_services'] = isset($data['extra_services']) ? $data['extra_services'] : null;
    }

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

        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 item_value
     *
     * @return double
     */
    public function getItemValue()
    {
        return $this->container['item_value'];
    }

    /**
     * Sets item_value
     *
     * @param double $item_value The value of the item. Required for Insurance and Collect On Delivery.  The price for Insurance, Registered Mail, and Collect On Delivery extra services will vary based on this value.
     *
     * @return $this
     */
    public function setItemValue($item_value)
    {
        $this->container['item_value'] = $item_value;

        return $this;
    }

    /**
     * Gets extra_services
     *
     * @return \USPS\DomesticPrices\Model\TotalRatesExtraServices
     */
    public function getExtraServices()
    {
        return $this->container['extra_services'];
    }

    /**
     * Sets extra_services
     *
     * @param \USPS\DomesticPrices\Model\TotalRatesExtraServices $extra_services extra_services
     *
     * @return $this
     */
    public function setExtraServices($extra_services)
    {
        $this->container['extra_services'] = $extra_services;

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