<?php
/**
 * InternationalRateListQuery
 *
 * 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 \ArrayAccess;
use \USPS\InternationalPrices\ObjectSerializer;

/**
 * InternationalRateListQuery Class Doc Comment
 *
 * @category Class
 * @description Informative details about all possible rate based on the ingredients.
 * @package  USPS\InternationalPrices
 * @author   Swagger Codegen team
 * @link     https://github.com/swagger-api/swagger-codegen
 */
class InternationalRateListQuery implements ModelInterface, ArrayAccess
{
    const DISCRIMINATOR = null;

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

    /**
      * Array of property to type mappings. Used for (de)serialization
      *
      * @var string[]
      */
    protected static $swaggerTypes = [
        'origin_zip_code' => '\USPS\InternationalPrices\Model\OriginZIPCode',
        'foreign_postal_code' => '\USPS\InternationalPrices\Model\ForeignPostalCode',
        'destination_country_code' => '\USPS\InternationalPrices\Model\DestinationCountryCode',
        'weight' => '\USPS\InternationalPrices\Model\WeightPounds',
        'mailing_date' => '\USPS\InternationalPrices\Model\MailingDate',
        'length' => '\USPS\InternationalPrices\Model\Length',
        'width' => '\USPS\InternationalPrices\Model\Width',
        'height' => '\USPS\InternationalPrices\Model\Height',
        'price_type' => '\USPS\InternationalPrices\Model\InternationalPriceType',
        'mail_class' => 'string',
        'account_type' => 'string',
        'account_number' => 'string'
    ];

    /**
      * Array of property to format mappings. Used for (de)serialization
      *
      * @var string[]
      */
    protected static $swaggerFormats = [
        'origin_zip_code' => null,
        'foreign_postal_code' => null,
        'destination_country_code' => null,
        'weight' => null,
        'mailing_date' => null,
        'length' => null,
        'width' => null,
        'height' => null,
        'price_type' => null,
        'mail_class' => null,
        'account_type' => null,
        'account_number' => 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 = [
        'origin_zip_code' => 'originZIPCode',
        'foreign_postal_code' => 'foreignPostalCode',
        'destination_country_code' => 'destinationCountryCode',
        'weight' => 'weight',
        'mailing_date' => 'mailingDate',
        'length' => 'length',
        'width' => 'width',
        'height' => 'height',
        'price_type' => 'priceType',
        'mail_class' => 'mailClass',
        'account_type' => 'accountType',
        'account_number' => 'accountNumber'
    ];

    /**
     * Array of attributes to setter functions (for deserialization of responses)
     *
     * @var string[]
     */
    protected static $setters = [
        'origin_zip_code' => 'setOriginZipCode',
        'foreign_postal_code' => 'setForeignPostalCode',
        'destination_country_code' => 'setDestinationCountryCode',
        'weight' => 'setWeight',
        'mailing_date' => 'setMailingDate',
        'length' => 'setLength',
        'width' => 'setWidth',
        'height' => 'setHeight',
        'price_type' => 'setPriceType',
        'mail_class' => 'setMailClass',
        'account_type' => 'setAccountType',
        'account_number' => 'setAccountNumber'
    ];

    /**
     * Array of attributes to getter functions (for serialization of requests)
     *
     * @var string[]
     */
    protected static $getters = [
        'origin_zip_code' => 'getOriginZipCode',
        'foreign_postal_code' => 'getForeignPostalCode',
        'destination_country_code' => 'getDestinationCountryCode',
        'weight' => 'getWeight',
        'mailing_date' => 'getMailingDate',
        'length' => 'getLength',
        'width' => 'getWidth',
        'height' => 'getHeight',
        'price_type' => 'getPriceType',
        'mail_class' => 'getMailClass',
        'account_type' => 'getAccountType',
        'account_number' => 'getAccountNumber'
    ];

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

    const MAIL_CLASS_FIRST_CLASS_PACKAGE_INTERNATIONAL_SERVICE = 'FIRST-CLASS_PACKAGE_INTERNATIONAL_SERVICE';
    const MAIL_CLASS_PRIORITY_MAIL_INTERNATIONAL = 'PRIORITY_MAIL_INTERNATIONAL';
    const MAIL_CLASS_PRIORITY_MAIL_EXPRESS_INTERNATIONAL = 'PRIORITY_MAIL_EXPRESS_INTERNATIONAL';
    const MAIL_CLASS_GLOBAL_EXPRESS_GUARANTEED = 'GLOBAL_EXPRESS_GUARANTEED';
    const MAIL_CLASS_ALL = 'ALL';
    const ACCOUNT_TYPE_EPS = 'EPS';
    const ACCOUNT_TYPE_PERMIT = 'PERMIT';
    const ACCOUNT_TYPE_METER = 'METER';

    /**
     * Gets allowable values of the enum
     *
     * @return string[]
     */
    public function getMailClassAllowableValues()
    {
        return [
            self::MAIL_CLASS_FIRST_CLASS_PACKAGE_INTERNATIONAL_SERVICE,
            self::MAIL_CLASS_PRIORITY_MAIL_INTERNATIONAL,
            self::MAIL_CLASS_PRIORITY_MAIL_EXPRESS_INTERNATIONAL,
            self::MAIL_CLASS_GLOBAL_EXPRESS_GUARANTEED,
            self::MAIL_CLASS_ALL,
        ];
    }
    /**
     * Gets allowable values of the enum
     *
     * @return string[]
     */
    public function getAccountTypeAllowableValues()
    {
        return [
            self::ACCOUNT_TYPE_EPS,
            self::ACCOUNT_TYPE_PERMIT,
            self::ACCOUNT_TYPE_METER,
        ];
    }

    /**
     * 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['origin_zip_code'] = isset($data['origin_zip_code']) ? $data['origin_zip_code'] : null;
        $this->container['foreign_postal_code'] = isset($data['foreign_postal_code']) ? $data['foreign_postal_code'] : null;
        $this->container['destination_country_code'] = isset($data['destination_country_code']) ? $data['destination_country_code'] : null;
        $this->container['weight'] = isset($data['weight']) ? $data['weight'] : null;
        $this->container['mailing_date'] = isset($data['mailing_date']) ? $data['mailing_date'] : null;
        $this->container['length'] = isset($data['length']) ? $data['length'] : null;
        $this->container['width'] = isset($data['width']) ? $data['width'] : null;
        $this->container['height'] = isset($data['height']) ? $data['height'] : null;
        $this->container['price_type'] = isset($data['price_type']) ? $data['price_type'] : null;
        $this->container['mail_class'] = isset($data['mail_class']) ? $data['mail_class'] : null;
        $this->container['account_type'] = isset($data['account_type']) ? $data['account_type'] : null;
        $this->container['account_number'] = isset($data['account_number']) ? $data['account_number'] : null;
    }

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

        if ($this->container['origin_zip_code'] === null) {
            $invalidProperties[] = "'origin_zip_code' can't be null";
        }
        if ($this->container['destination_country_code'] === null) {
            $invalidProperties[] = "'destination_country_code' can't be null";
        }
        if ($this->container['weight'] === null) {
            $invalidProperties[] = "'weight' can't be null";
        }
        if ($this->container['length'] === null) {
            $invalidProperties[] = "'length' can't be null";
        }
        if ($this->container['width'] === null) {
            $invalidProperties[] = "'width' can't be null";
        }
        if ($this->container['height'] === null) {
            $invalidProperties[] = "'height' can't be null";
        }
        $allowedValues = $this->getMailClassAllowableValues();
        if (!is_null($this->container['mail_class']) && !in_array($this->container['mail_class'], $allowedValues, true)) {
            $invalidProperties[] = sprintf(
                "invalid value for 'mail_class', must be one of '%s'",
                implode("', '", $allowedValues)
            );
        }

        $allowedValues = $this->getAccountTypeAllowableValues();
        if (!is_null($this->container['account_type']) && !in_array($this->container['account_type'], $allowedValues, true)) {
            $invalidProperties[] = sprintf(
                "invalid value for 'account_type', must be one of '%s'",
                implode("', '", $allowedValues)
            );
        }

        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 origin_zip_code
     *
     * @return \USPS\InternationalPrices\Model\OriginZIPCode
     */
    public function getOriginZipCode()
    {
        return $this->container['origin_zip_code'];
    }

    /**
     * Sets origin_zip_code
     *
     * @param \USPS\InternationalPrices\Model\OriginZIPCode $origin_zip_code origin_zip_code
     *
     * @return $this
     */
    public function setOriginZipCode($origin_zip_code)
    {
        $this->container['origin_zip_code'] = $origin_zip_code;

        return $this;
    }

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

    /**
     * Sets foreign_postal_code
     *
     * @param \USPS\InternationalPrices\Model\ForeignPostalCode $foreign_postal_code foreign_postal_code
     *
     * @return $this
     */
    public function setForeignPostalCode($foreign_postal_code)
    {
        $this->container['foreign_postal_code'] = $foreign_postal_code;

        return $this;
    }

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

    /**
     * Sets destination_country_code
     *
     * @param \USPS\InternationalPrices\Model\DestinationCountryCode $destination_country_code destination_country_code
     *
     * @return $this
     */
    public function setDestinationCountryCode($destination_country_code)
    {
        $this->container['destination_country_code'] = $destination_country_code;

        return $this;
    }

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

    /**
     * Sets weight
     *
     * @param \USPS\InternationalPrices\Model\WeightPounds $weight weight
     *
     * @return $this
     */
    public function setWeight($weight)
    {
        $this->container['weight'] = $weight;

        return $this;
    }

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

    /**
     * Sets mailing_date
     *
     * @param \USPS\InternationalPrices\Model\MailingDate $mailing_date mailing_date
     *
     * @return $this
     */
    public function setMailingDate($mailing_date)
    {
        $this->container['mailing_date'] = $mailing_date;

        return $this;
    }

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

    /**
     * Sets length
     *
     * @param \USPS\InternationalPrices\Model\Length $length length
     *
     * @return $this
     */
    public function setLength($length)
    {
        $this->container['length'] = $length;

        return $this;
    }

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

    /**
     * Sets width
     *
     * @param \USPS\InternationalPrices\Model\Width $width width
     *
     * @return $this
     */
    public function setWidth($width)
    {
        $this->container['width'] = $width;

        return $this;
    }

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

    /**
     * Sets height
     *
     * @param \USPS\InternationalPrices\Model\Height $height height
     *
     * @return $this
     */
    public function setHeight($height)
    {
        $this->container['height'] = $height;

        return $this;
    }

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

    /**
     * Sets price_type
     *
     * @param \USPS\InternationalPrices\Model\InternationalPriceType $price_type price_type
     *
     * @return $this
     */
    public function setPriceType($price_type)
    {
        $this->container['price_type'] = $price_type;

        return $this;
    }

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

    /**
     * Sets mail_class
     *
     * @param string $mail_class The mail service requested.  * 'FIRST-CLASS_PACKAGE_INTERNATIONAL_SERVICE'  * 'PRIORITY_MAIL_INTERNATIONAL'  * 'PRIORITY_MAIL_EXPRESS_INTERNATIONAL'  * 'GLOBAL_EXPRESS_GUARANTEED' - Global Express Guaranteed Service is suspended as of September 29, 2024.  * 'ALL'
     *
     * @return $this
     */
    public function setMailClass($mail_class)
    {
        $allowedValues = $this->getMailClassAllowableValues();
        if (!is_null($mail_class) && !in_array($mail_class, $allowedValues, true)) {
            throw new \InvalidArgumentException(
                sprintf(
                    "Invalid value for 'mail_class', must be one of '%s'",
                    implode("', '", $allowedValues)
                )
            );
        }
        $this->container['mail_class'] = $mail_class;

        return $this;
    }

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

    /**
     * Sets account_type
     *
     * @param string $account_type The type of payment account linked to a contract rate.  Note: - `METER` pricing is only available to PC Postage providers.
     *
     * @return $this
     */
    public function setAccountType($account_type)
    {
        $allowedValues = $this->getAccountTypeAllowableValues();
        if (!is_null($account_type) && !in_array($account_type, $allowedValues, true)) {
            throw new \InvalidArgumentException(
                sprintf(
                    "Invalid value for 'account_type', must be one of '%s'",
                    implode("', '", $allowedValues)
                )
            );
        }
        $this->container['account_type'] = $account_type;

        return $this;
    }

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

    /**
     * Sets account_number
     *
     * @param string $account_number The Enterprise Payment Account, Permit number or PC Postage meter number associated with a contract.
     *
     * @return $this
     */
    public function setAccountNumber($account_number)
    {
        $this->container['account_number'] = $account_number;

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