<?php
/**
 * InternationalPackageOptions
 *
 * 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;

/**
 * InternationalPackageOptions Class Doc Comment
 *
 * @category Class
 * @description Additional options for international package shipments including redirect addresses, over-labeling information, and manifest preferences.
 * @package  USPS\InternationalLabels
 * @author   Swagger Codegen team
 * @link     https://github.com/swagger-api/swagger-codegen
 */
class InternationalPackageOptions extends PackageOptions 
{
    const DISCRIMINATOR = null;

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

    /**
      * Array of property to type mappings. Used for (de)serialization
      *
      * @var string[]
      */
    protected static $swaggerTypes = [
        'redirect_address' => '',
        'original_package' => '\USPS\InternationalLabels\Model\InternationalPackageOptionsOriginalPackage',
        'generate_gx_event' => 'bool',
        'immediate_manifest' => 'bool'
    ];

    /**
      * Array of property to format mappings. Used for (de)serialization
      *
      * @var string[]
      */
    protected static $swaggerFormats = [
        'redirect_address' => null,
        'original_package' => null,
        'generate_gx_event' => null,
        'immediate_manifest' => 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 = [
        'redirect_address' => 'redirectAddress',
        'original_package' => 'originalPackage',
        'generate_gx_event' => 'generateGXEvent',
        'immediate_manifest' => 'immediateManifest'
    ];

    /**
     * Array of attributes to setter functions (for deserialization of responses)
     *
     * @var string[]
     */
    protected static $setters = [
        'redirect_address' => 'setRedirectAddress',
        'original_package' => 'setOriginalPackage',
        'generate_gx_event' => 'setGenerateGxEvent',
        'immediate_manifest' => 'setImmediateManifest'
    ];

    /**
     * Array of attributes to getter functions (for serialization of requests)
     *
     * @var string[]
     */
    protected static $getters = [
        'redirect_address' => 'getRedirectAddress',
        'original_package' => 'getOriginalPackage',
        'generate_gx_event' => 'getGenerateGxEvent',
        'immediate_manifest' => 'getImmediateManifest'
    ];

    /**
     * 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['redirect_address'] = isset($data['redirect_address']) ? $data['redirect_address'] : null;
        $this->container['original_package'] = isset($data['original_package']) ? $data['original_package'] : null;
        $this->container['generate_gx_event'] = isset($data['generate_gx_event']) ? $data['generate_gx_event'] : true;
        $this->container['immediate_manifest'] = isset($data['immediate_manifest']) ? $data['immediate_manifest'] : false;
    }

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

    /**
     * Sets redirect_address
     *
     * @param  $redirect_address Address where the package will be redirected to if undeliverable and  a `nonDeliveryOption` of REDIRECT is provided. This field is required if REDIRECT `nonDeliveryOption` is provided.  Note: - The First and Last Name or Firm Name are required when `redirectAddress` is populated.
     *
     * @return $this
     */
    public function setRedirectAddress($redirect_address)
    {
        $this->container['redirect_address'] = $redirect_address;

        return $this;
    }

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

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

        return $this;
    }

    /**
     * Gets generate_gx_event
     *
     * @return bool
     */
    public function getGenerateGxEvent()
    {
        return $this->container['generate_gx_event'];
    }

    /**
     * Sets generate_gx_event
     *
     * @param bool $generate_gx_event Provides the option for a user to not create a \"GX\" event for the package. By default, a GX event will be created.
     *
     * @return $this
     */
    public function setGenerateGxEvent($generate_gx_event)
    {
        $this->container['generate_gx_event'] = $generate_gx_event;

        return $this;
    }

    /**
     * Gets immediate_manifest
     *
     * @return bool
     */
    public function getImmediateManifest()
    {
        return $this->container['immediate_manifest'];
    }

    /**
     * Sets immediate_manifest
     *
     * @param bool $immediate_manifest Setting this field to `true` will send electronic data to Postal systems within 15 minutes of label creation. If invoked, this label <u><strong>cannot</strong></u> be cancelled. Instead, one must request an unused label refund – which may be subject to an admin fee. Depending on time of label creation, your packages could be charged same day instead of next day.
     *
     * @return $this
     */
    public function setImmediateManifest($immediate_manifest)
    {
        $this->container['immediate_manifest'] = $immediate_manifest;

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