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

/**
 * International Prices
 *
 * Contact Us: [USPS API Support](https://emailus.usps.com/s/usps-APIs) | [Terms of Service](https://about.usps.com/termsofuse.htm)  The International Prices API allows users to retrieve International postage rates for packages by: * Look up International Base Postage based on a set of given package characteristics * Look up International Base Postage based on a given SKU  The USPS&#174; has implemented Stock Keeping Units (SKUs) which provide unique identification for their products. These SKUs are available for download online for mailers.   For further details on package specifications, delivery information, and more, please consult the [International Mail Manual. (IMM)](https://pe.usps.com/text/imm/welcome.htm). For a list of published rates please refer to the [USPS Price List](https://pe.usps.com/text/dmm300/Notice123.htm) To discover the rate ingredients for this API, take a look at [Publication 205](http://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.
 *
 * OpenAPI spec version: 3.3.10
 * 
 * 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\InternationalPrices\Model;
use \USPS\InternationalPrices\ObjectSerializer;

/**
 * TotalRatesQuery Class Doc Comment
 *
 * @category Class
 * @description Search parameters for base rate and extra service rate.
 * @package  USPS\InternationalPrices
 * @author   Swagger Codegen team
 * @link     https://github.com/swagger-api/swagger-codegen
 */
class TotalRatesQuery extends InternationalRateListQuery 
{
    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 = [
        'request_duties_taxes_fees' => 'bool',
        'destination_city' => 'string',
        'destination_state' => 'string',
        'items' => '\USPS\InternationalPrices\Model\TotalRatesRequestLandedCostItem[]',
        'item_value' => 'double',
        'extra_services' => 'int[]'
    ];

    /**
      * Array of property to format mappings. Used for (de)serialization
      *
      * @var string[]
      */
    protected static $swaggerFormats = [
        'request_duties_taxes_fees' => null,
        'destination_city' => null,
        'destination_state' => null,
        'items' => null,
        '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 = [
        'request_duties_taxes_fees' => 'requestDutiesTaxesFees',
        'destination_city' => 'destinationCity',
        'destination_state' => 'destinationState',
        'items' => 'items',
        'item_value' => 'itemValue',
        'extra_services' => 'extraServices'
    ];

    /**
     * Array of attributes to setter functions (for deserialization of responses)
     *
     * @var string[]
     */
    protected static $setters = [
        'request_duties_taxes_fees' => 'setRequestDutiesTaxesFees',
        'destination_city' => 'setDestinationCity',
        'destination_state' => 'setDestinationState',
        'items' => 'setItems',
        'item_value' => 'setItemValue',
        'extra_services' => 'setExtraServices'
    ];

    /**
     * Array of attributes to getter functions (for serialization of requests)
     *
     * @var string[]
     */
    protected static $getters = [
        'request_duties_taxes_fees' => 'getRequestDutiesTaxesFees',
        'destination_city' => 'getDestinationCity',
        'destination_state' => 'getDestinationState',
        'items' => 'getItems',
        '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;
    }

    const EXTRA_SERVICES__370 = '370';
    const EXTRA_SERVICES__813 = '813';
    const EXTRA_SERVICES__820 = '820';
    const EXTRA_SERVICES__826 = '826';
    const EXTRA_SERVICES__857 = '857';
    const EXTRA_SERVICES__930 = '930';
    const EXTRA_SERVICES__931 = '931';
    const EXTRA_SERVICES__955 = '955';

    /**
     * Gets allowable values of the enum
     *
     * @return string[]
     */
    public function getExtraServicesAllowableValues()
    {
        return [
            self::EXTRA_SERVICES__370,
            self::EXTRA_SERVICES__813,
            self::EXTRA_SERVICES__820,
            self::EXTRA_SERVICES__826,
            self::EXTRA_SERVICES__857,
            self::EXTRA_SERVICES__930,
            self::EXTRA_SERVICES__931,
            self::EXTRA_SERVICES__955
        ];
    }


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

        $this->container['request_duties_taxes_fees'] = isset($data['request_duties_taxes_fees']) ? $data['request_duties_taxes_fees'] : false;
        $this->container['destination_city'] = isset($data['destination_city']) ? $data['destination_city'] : null;
        $this->container['destination_state'] = isset($data['destination_state']) ? $data['destination_state'] : null;
        $this->container['items'] = isset($data['items']) ? $data['items'] : null;
        $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 request_duties_taxes_fees
     *
     * @return bool
     */
    public function getRequestDutiesTaxesFees()
    {
        return $this->container['request_duties_taxes_fees'];
    }

    /**
     * Sets request_duties_taxes_fees
     *
     * @param bool $request_duties_taxes_fees When `true` the returned `rateOption` elements will include the duties and taxes cost for each item and package fees.
     *
     * @return $this
     */
    public function setRequestDutiesTaxesFees($request_duties_taxes_fees)
    {
        $this->container['request_duties_taxes_fees'] = $request_duties_taxes_fees;

        return $this;
    }

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

    /**
     * Sets destination_city
     *
     * @param string $destination_city When `requestDutiesTaxesFees` is `true` then `destinationCity` may be required based on the country of import.
     *
     * @return $this
     */
    public function setDestinationCity($destination_city)
    {
        $this->container['destination_city'] = $destination_city;

        return $this;
    }

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

    /**
     * Sets destination_state
     *
     * @param string $destination_state When `requestDutiesTaxesFees` is `true` then `destinationState` may be required based on the country of import.
     *
     * @return $this
     */
    public function setDestinationState($destination_state)
    {
        $this->container['destination_state'] = $destination_state;

        return $this;
    }

    /**
     * Gets items
     *
     * @return \USPS\InternationalPrices\Model\TotalRatesRequestLandedCostItem[]
     */
    public function getItems()
    {
        return $this->container['items'];
    }

    /**
     * Sets items
     *
     * @param \USPS\InternationalPrices\Model\TotalRatesRequestLandedCostItem[] $items A list of items utilized for pricing when `requestDutiesTaxesFees` is `true`.
     *
     * @return $this
     */
    public function setItems($items)
    {
        $this->container['items'] = $items;

        return $this;
    }

    /**
     * Gets item_value
     *
     * @return double
     */
    public function getItemValue()
    {
        return $this->container['item_value'];
    }

    /**
     * Sets item_value
     *
     * @param double $item_value The value of the all items in the package. Required for Insurance and Registered Mail.
     *
     * @return $this
     */
    public function setItemValue($item_value)
    {
        $this->container['item_value'] = $item_value;

        return $this;
    }

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

    /**
     * Sets extra_services
     *
     * @param int[] $extra_services A list of Extra Services to be included in the total rates search. If no extra services are specified all applicable extra services for the mail class will be returned.
     *
     * @return $this
     */
    public function setExtraServices($extra_services)
    {
        $allowedValues = $this->getExtraServicesAllowableValues();
        if (!is_null($extra_services) && array_diff($extra_services, $allowedValues)) {
            throw new \InvalidArgumentException(
                sprintf(
                    "Invalid value for 'extra_services', must be one of '%s'",
                    implode("', '", $allowedValues)
                )
            );
        }
        $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));
    }
}
