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

/**
 * 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; Labels API allows you to digitally create mailing labels for the following mail classes: USPS Ground Advantage&#8482;, Parcel Select&#174; Destination Entry, Parcel Select Lightweight&#174;, USPS Connect&#174; Local, USPS Connect&#174; Regional, Priority  Mail&#174;, Priority Mail Express&#174;, Bound Printed Matter, Library Mail, and Media Mail&#174;.  * Use the [Getting Started guide](https://developers.usps.com/getting-started) to get started with the Labels API. * The USPS&#174; 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).  **Manifest Scheduling**   The following table outlines the Domestic Label manifesting schedule for specific conditions listed below.   | Condition                   | Scheduling | | ----------------------------| -------- | | **Customs Forms labels**    | 12:30am CT on the day after label creation. | | **Return labels**    | 12:30am CT on the day after label creation. | | **Smart Locker labels**     | Electronic data is sent to Postal systems within 15 minutes of label creation. | | **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 after the `mailingDate` value provided by the user |
 *
 * OpenAPI spec version: 3.9.9
 * 
 * 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\Labels\Model;
use \USPS\Labels\ObjectSerializer;

/**
 * ReturnsPackageDescription Class Doc Comment
 *
 * @category Class
 * @package  USPS\Labels
 * @author   Swagger Codegen team
 * @link     https://github.com/swagger-api/swagger-codegen
 */
class ReturnsPackageDescription extends BaseReturnsPackageDescription 
{
    const DISCRIMINATOR = null;

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

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

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

    /**
     * Array of attributes to setter functions (for deserialization of responses)
     *
     * @var string[]
     */
    protected static $setters = [
        'rate_indicator' => 'setRateIndicator'
    ];

    /**
     * Array of attributes to getter functions (for serialization of requests)
     *
     * @var string[]
     */
    protected static $getters = [
        'rate_indicator' => 'getRateIndicator'
    ];

    /**
     * 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 RATE_INDICATOR_CP = 'CP';
    const RATE_INDICATOR_DN = 'DN';
    const RATE_INDICATOR_DR = 'DR';
    const RATE_INDICATOR_E4 = 'E4';
    const RATE_INDICATOR_E6 = 'E6';
    const RATE_INDICATOR_FA = 'FA';
    const RATE_INDICATOR_FB = 'FB';
    const RATE_INDICATOR_FE = 'FE';
    const RATE_INDICATOR_FP = 'FP';
    const RATE_INDICATOR_FS = 'FS';
    const RATE_INDICATOR_OS = 'OS';
    const RATE_INDICATOR_P5 = 'P5';
    const RATE_INDICATOR_P6 = 'P6';
    const RATE_INDICATOR_P7 = 'P7';
    const RATE_INDICATOR_P8 = 'P8';
    const RATE_INDICATOR_P9 = 'P9';
    const RATE_INDICATOR_PA = 'PA';
    const RATE_INDICATOR_PL = 'PL';
    const RATE_INDICATOR_PM = 'PM';
    const RATE_INDICATOR_Q6 = 'Q6';
    const RATE_INDICATOR_Q7 = 'Q7';
    const RATE_INDICATOR_Q8 = 'Q8';
    const RATE_INDICATOR_Q9 = 'Q9';
    const RATE_INDICATOR_Q0 = 'Q0';
    const RATE_INDICATOR_SP = 'SP';

    /**
     * Gets allowable values of the enum
     *
     * @return string[]
     */
    public function getRateIndicatorAllowableValues()
    {
        return [
            self::RATE_INDICATOR_CP,
            self::RATE_INDICATOR_DN,
            self::RATE_INDICATOR_DR,
            self::RATE_INDICATOR_E4,
            self::RATE_INDICATOR_E6,
            self::RATE_INDICATOR_FA,
            self::RATE_INDICATOR_FB,
            self::RATE_INDICATOR_FE,
            self::RATE_INDICATOR_FP,
            self::RATE_INDICATOR_FS,
            self::RATE_INDICATOR_OS,
            self::RATE_INDICATOR_P5,
            self::RATE_INDICATOR_P6,
            self::RATE_INDICATOR_P7,
            self::RATE_INDICATOR_P8,
            self::RATE_INDICATOR_P9,
            self::RATE_INDICATOR_PA,
            self::RATE_INDICATOR_PL,
            self::RATE_INDICATOR_PM,
            self::RATE_INDICATOR_Q6,
            self::RATE_INDICATOR_Q7,
            self::RATE_INDICATOR_Q8,
            self::RATE_INDICATOR_Q9,
            self::RATE_INDICATOR_Q0,
            self::RATE_INDICATOR_SP
        ];
    }


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

        $this->container['rate_indicator'] = isset($data['rate_indicator']) ? $data['rate_indicator'] : 'SP';
    }

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

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

    /**
     * Sets rate_indicator
     *
     * @param string $rate_indicator Use to specify USPS containers/packaging or container attributes that may affect postage.  * CP - Cubic Parcel  * DN - Dimensional Nonrectangular  * DR - Dimensional Rectangular  * E4 - Priority Mail Express Flat Rate Envelope - Post Office To Addressee  * E6 - Priority Mail Express Legal Flat Rate Envelope  * FA - Legal Flat Rate Envelope  * FB - Medium Flat Rate Box/Large Flat Rate Bag  * FE - Flat Rate Envelope  * FP - Padded Flat Rate Envelope  * FS - Small Flat Rate Box  * OS - Oversized  * P5 - Cubic Soft Pack Tier 1  * P6 - Cubic Soft Pack Tier 2  * P7 - Cubic Soft Pack Tier 3  * P8 - Cubic Soft Pack Tier 4  * P9 - Cubic Soft Pack Tier 5  * Q6 - Cubic Soft Pack Tier 6  * Q7 - Cubic Soft Pack Tier 7  * Q8 - Cubic Soft Pack Tier 8  * Q9 - Cubic Soft Pack Tier 9  * Q0 - Cubic Soft Pack Tier 10  * PA - Priority Mail Express Single Piece  * PL - Large Flat Rate Box  * PM - Large Flat Rate Box APO/FPO/DPO  * SP - Single Piece
     *
     * @return $this
     */
    public function setRateIndicator($rate_indicator)
    {
        $allowedValues = $this->getRateIndicatorAllowableValues();
        if (!in_array($rate_indicator, $allowedValues, true)) {
            throw new \InvalidArgumentException(
                sprintf(
                    "Invalid value for 'rate_indicator', must be one of '%s'",
                    implode("', '", $allowedValues)
                )
            );
        }
        $this->container['rate_indicator'] = $rate_indicator;

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