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

/**
 * International Labels
 *
 * Contact Us: [USPS API Support](https://emailus.usps.com/s/usps-APIs) | [Terms of Service](https://about.usps.com/termsofuse.htm)  The USPS&#174; International Labels API allows you to digitally create mailing labels for `FIRST-CLASS_PACKAGE_INTERNATIONAL_SERVICE`, `PRIORITY_MAIL_INTERNATIONAL`, and `PRIORITY_MAIL_EXPRESS_INTERNATIONAL`.  * Use the [Getting Started guide](https://developers.usps.com/getting-started) to get started with the Labels API. * The USPS&#174; International Labels API uses a token to authorize the use of an [Enterprise Payment](https://postalpro.usps.com/EPS) or Permit account. The specification to generate the token is in the [Payments 3.0 - Set Payment Account Information](https://developers.usps.com/paymentsv3#tag/Resources/operation/post-payments-payment-authorization).  **References**: * [Publication 199](http://postalpro.usps.com/pub199) * [Publication 205](http://postalpro.usps.com/pub205)  **Manifest Scheduling**   The following table outlines the International Label manifesting schedule for specific conditions listed below.   | Condition                   | Scheduling | | ----------------------------| -------- | | **Value of `true` provided for `immediateManifest` field**| Electronic data is sent to Postal systems within 15 minutes of label creation.  | | **Label is added to a [SCAN Form](https://developers.usps.com/scanv3#tag/Resources/operation/post-scan-form)**| Electronic data is sent to Postal systems within 15 minutes of SCAN Form creation.  | | **All other conditions**    | 12:30am CT on the day after label creation. |
 *
 * OpenAPI spec version: 3.3.4
 * 
 * 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\InternationalLabels\Model;
use \USPS\InternationalLabels\ObjectSerializer;

/**
 * InternationalAddress Class Doc Comment
 *
 * @category Class
 * @description Address fields for International locations.
 * @package  USPS\InternationalLabels
 * @author   Swagger Codegen team
 * @link     https://github.com/swagger-api/swagger-codegen
 */
class InternationalAddress extends Address 
{
    const DISCRIMINATOR = null;

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

    /**
      * Array of property to type mappings. Used for (de)serialization
      *
      * @var string[]
      */
    protected static $swaggerTypes = [
        'city' => 'string',
        'postal_code' => 'string',
        'province' => 'string',
        'province_iso_alpha2_code' => '\USPS\InternationalLabels\Model\ProvinceISOAlpha2Code',
        'country' => 'string',
        'country_iso_alpha2_code' => 'string'
    ];

    /**
      * Array of property to format mappings. Used for (de)serialization
      *
      * @var string[]
      */
    protected static $swaggerFormats = [
        'city' => null,
        'postal_code' => null,
        'province' => null,
        'province_iso_alpha2_code' => null,
        'country' => null,
        'country_iso_alpha2_code' => 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 = [
        'city' => 'city',
        'postal_code' => 'postalCode',
        'province' => 'province',
        'province_iso_alpha2_code' => 'provinceISOAlpha2Code',
        'country' => 'country',
        'country_iso_alpha2_code' => 'countryISOAlpha2Code'
    ];

    /**
     * Array of attributes to setter functions (for deserialization of responses)
     *
     * @var string[]
     */
    protected static $setters = [
        'city' => 'setCity',
        'postal_code' => 'setPostalCode',
        'province' => 'setProvince',
        'province_iso_alpha2_code' => 'setProvinceIsoAlpha2Code',
        'country' => 'setCountry',
        'country_iso_alpha2_code' => 'setCountryIsoAlpha2Code'
    ];

    /**
     * Array of attributes to getter functions (for serialization of requests)
     *
     * @var string[]
     */
    protected static $getters = [
        'city' => 'getCity',
        'postal_code' => 'getPostalCode',
        'province' => 'getProvince',
        'province_iso_alpha2_code' => 'getProvinceIsoAlpha2Code',
        'country' => 'getCountry',
        'country_iso_alpha2_code' => 'getCountryIsoAlpha2Code'
    ];

    /**
     * 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['city'] = isset($data['city']) ? $data['city'] : null;
        $this->container['postal_code'] = isset($data['postal_code']) ? $data['postal_code'] : null;
        $this->container['province'] = isset($data['province']) ? $data['province'] : null;
        $this->container['province_iso_alpha2_code'] = isset($data['province_iso_alpha2_code']) ? $data['province_iso_alpha2_code'] : null;
        $this->container['country'] = isset($data['country']) ? $data['country'] : null;
        $this->container['country_iso_alpha2_code'] = isset($data['country_iso_alpha2_code']) ? $data['country_iso_alpha2_code'] : 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 city
     *
     * @return string
     */
    public function getCity()
    {
        return $this->container['city'];
    }

    /**
     * Sets city
     *
     * @param string $city This is the city name of the address.
     *
     * @return $this
     */
    public function setCity($city)
    {
        $this->container['city'] = $city;

        return $this;
    }

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

    /**
     * Sets postal_code
     *
     * @param string $postal_code This is the Postal Code used for international addresses.  Note: - When shipping to Canada, this field must start with a letter (A-Z) - Different shipping destinations may require a postal code for shipping.  For more details, review the [Individual Country Listing](https://pe.usps.com/text/imm/immctry.htm) for your shipping destination
     *
     * @return $this
     */
    public function setPostalCode($postal_code)
    {
        $this->container['postal_code'] = $postal_code;

        return $this;
    }

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

    /**
     * Sets province
     *
     * @param string $province This is the province used for international addresses.
     *
     * @return $this
     */
    public function setProvince($province)
    {
        $this->container['province'] = $province;

        return $this;
    }

    /**
     * Gets province_iso_alpha2_code
     *
     * @return \USPS\InternationalLabels\Model\ProvinceISOAlpha2Code
     */
    public function getProvinceIsoAlpha2Code()
    {
        return $this->container['province_iso_alpha2_code'];
    }

    /**
     * Sets province_iso_alpha2_code
     *
     * @param \USPS\InternationalLabels\Model\ProvinceISOAlpha2Code $province_iso_alpha2_code province_iso_alpha2_code
     *
     * @return $this
     */
    public function setProvinceIsoAlpha2Code($province_iso_alpha2_code)
    {
        $this->container['province_iso_alpha2_code'] = $province_iso_alpha2_code;

        return $this;
    }

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

    /**
     * Sets country
     *
     * @param string $country This is the country name used in an international address.
     *
     * @return $this
     */
    public function setCountry($country)
    {
        $this->container['country'] = $country;

        return $this;
    }

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

    /**
     * Sets country_iso_alpha2_code
     *
     * @param string $country_iso_alpha2_code ISO 3166-1 alpha-2 codes are two-letter country codes defined in ISO 3166-1, part of the ISO 3166 standard[1] published by the International Organization for Standardization (ISO), to represent countries, dependent territories, and special areas of geographical interest. They are the most widely used of the country codes published by ISO (the others being alpha-3 and numeric), and are used most prominently for the Internet's country code top-level domains (with a few exceptions). They are also used as country identifiers extending the postal code when appropriate within the international postal system for paper mail, and have replaced the previous one consisting of one-letter codes. They were first included as part of the ISO 3166 standard in its first edition in 1974.
     *
     * @return $this
     */
    public function setCountryIsoAlpha2Code($country_iso_alpha2_code)
    {
        $this->container['country_iso_alpha2_code'] = $country_iso_alpha2_code;

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