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

/**
 * InternationalPackageOptionsOriginalPackage Class Doc Comment
 *
 * @category Class
 * @description Information about the original package when an over labeled package is being created.
 * @package  USPS\InternationalLabels
 * @author   Swagger Codegen team
 * @link     https://github.com/swagger-api/swagger-codegen
 */
class InternationalPackageOptionsOriginalPackage implements ModelInterface, ArrayAccess
{
    const DISCRIMINATOR = null;

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

    /**
      * Array of property to type mappings. Used for (de)serialization
      *
      * @var string[]
      */
    protected static $swaggerTypes = [
        'original_tracking_number' => 'string',
        'original_construct_code' => 'string'
    ];

    /**
      * Array of property to format mappings. Used for (de)serialization
      *
      * @var string[]
      */
    protected static $swaggerFormats = [
        'original_tracking_number' => null,
        'original_construct_code' => 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 = [
        'original_tracking_number' => 'originalTrackingNumber',
        'original_construct_code' => 'originalConstructCode'
    ];

    /**
     * Array of attributes to setter functions (for deserialization of responses)
     *
     * @var string[]
     */
    protected static $setters = [
        'original_tracking_number' => 'setOriginalTrackingNumber',
        'original_construct_code' => 'setOriginalConstructCode'
    ];

    /**
     * Array of attributes to getter functions (for serialization of requests)
     *
     * @var string[]
     */
    protected static $getters = [
        'original_tracking_number' => 'getOriginalTrackingNumber',
        'original_construct_code' => 'getOriginalConstructCode'
    ];

    /**
     * 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 ORIGINAL_CONSTRUCT_CODE_G01 = 'G01';
    const ORIGINAL_CONSTRUCT_CODE_I01 = 'I01';

    /**
     * Gets allowable values of the enum
     *
     * @return string[]
     */
    public function getOriginalConstructCodeAllowableValues()
    {
        return [
            self::ORIGINAL_CONSTRUCT_CODE_G01,
            self::ORIGINAL_CONSTRUCT_CODE_I01
        ];
    }

    /**
     * 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['original_tracking_number'] = isset($data['original_tracking_number']) ? $data['original_tracking_number'] : null;
        $this->container['original_construct_code'] = isset($data['original_construct_code']) ? $data['original_construct_code'] : 'I01';
    }

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

        if ($this->container['original_tracking_number'] === null) {
            $invalidProperties[] = "'original_tracking_number' can't be null";
        }
        if ($this->container['original_construct_code'] === null) {
            $invalidProperties[] = "'original_construct_code' can't be null";
        }
        $allowedValues = $this->getOriginalConstructCodeAllowableValues();
        if (!is_null($this->container['original_construct_code']) && !in_array($this->container['original_construct_code'], $allowedValues, true)) {
            $invalidProperties[] = sprintf(
                "invalid value for 'original_construct_code', 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 original_tracking_number
     *
     * @return string
     */
    public function getOriginalTrackingNumber()
    {
        return $this->container['original_tracking_number'];
    }

    /**
     * Sets original_tracking_number
     *
     * @param string $original_tracking_number The tracking number associated with the package before it was over labeled.
     *
     * @return $this
     */
    public function setOriginalTrackingNumber($original_tracking_number)
    {
        $this->container['original_tracking_number'] = $original_tracking_number;

        return $this;
    }

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

    /**
     * Sets original_construct_code
     *
     * @param string $original_construct_code A 3-character code to identify the construct of the Original Label Tracking Number.
     *
     * @return $this
     */
    public function setOriginalConstructCode($original_construct_code)
    {
        $allowedValues = $this->getOriginalConstructCodeAllowableValues();
        if (!in_array($original_construct_code, $allowedValues, true)) {
            throw new \InvalidArgumentException(
                sprintf(
                    "Invalid value for 'original_construct_code', must be one of '%s'",
                    implode("', '", $allowedValues)
                )
            );
        }
        $this->container['original_construct_code'] = $original_construct_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));
    }
}
