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

/**
 * ShippingContents Class Doc Comment
 *
 * @category Class
 * @description Required repeating up to 30 times.
 * @package  USPS\InternationalLabels
 * @author   Swagger Codegen team
 * @link     https://github.com/swagger-api/swagger-codegen
 */
class ShippingContents implements ModelInterface, ArrayAccess
{
    const DISCRIMINATOR = null;

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

    /**
      * Array of property to type mappings. Used for (de)serialization
      *
      * @var string[]
      */
    protected static $swaggerTypes = [
        'item_description' => 'string',
        'item_quantity' => 'int',
        'item_value' => 'float',
        'item_total_value' => 'float',
        'weight_uom' => 'string',
        'item_weight' => 'float',
        'item_total_weight' => 'float',
        'hs_tariff_number' => 'string',
        'countryof_origin' => 'string',
        'item_category' => 'string',
        'item_subcategory' => 'string'
    ];

    /**
      * Array of property to format mappings. Used for (de)serialization
      *
      * @var string[]
      */
    protected static $swaggerFormats = [
        'item_description' => null,
        'item_quantity' => null,
        'item_value' => null,
        'item_total_value' => null,
        'weight_uom' => null,
        'item_weight' => null,
        'item_total_weight' => null,
        'hs_tariff_number' => null,
        'countryof_origin' => null,
        'item_category' => null,
        'item_subcategory' => 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 = [
        'item_description' => 'itemDescription',
        'item_quantity' => 'itemQuantity',
        'item_value' => 'itemValue',
        'item_total_value' => 'itemTotalValue',
        'weight_uom' => 'weightUOM',
        'item_weight' => 'itemWeight',
        'item_total_weight' => 'itemTotalWeight',
        'hs_tariff_number' => 'HSTariffNumber',
        'countryof_origin' => 'countryofOrigin',
        'item_category' => 'itemCategory',
        'item_subcategory' => 'itemSubcategory'
    ];

    /**
     * Array of attributes to setter functions (for deserialization of responses)
     *
     * @var string[]
     */
    protected static $setters = [
        'item_description' => 'setItemDescription',
        'item_quantity' => 'setItemQuantity',
        'item_value' => 'setItemValue',
        'item_total_value' => 'setItemTotalValue',
        'weight_uom' => 'setWeightUom',
        'item_weight' => 'setItemWeight',
        'item_total_weight' => 'setItemTotalWeight',
        'hs_tariff_number' => 'setHsTariffNumber',
        'countryof_origin' => 'setCountryofOrigin',
        'item_category' => 'setItemCategory',
        'item_subcategory' => 'setItemSubcategory'
    ];

    /**
     * Array of attributes to getter functions (for serialization of requests)
     *
     * @var string[]
     */
    protected static $getters = [
        'item_description' => 'getItemDescription',
        'item_quantity' => 'getItemQuantity',
        'item_value' => 'getItemValue',
        'item_total_value' => 'getItemTotalValue',
        'weight_uom' => 'getWeightUom',
        'item_weight' => 'getItemWeight',
        'item_total_weight' => 'getItemTotalWeight',
        'hs_tariff_number' => 'getHsTariffNumber',
        'countryof_origin' => 'getCountryofOrigin',
        'item_category' => 'getItemCategory',
        'item_subcategory' => 'getItemSubcategory'
    ];

    /**
     * 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 WEIGHT_UOM_LB = 'lb';

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

    /**
     * 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['item_description'] = isset($data['item_description']) ? $data['item_description'] : null;
        $this->container['item_quantity'] = isset($data['item_quantity']) ? $data['item_quantity'] : null;
        $this->container['item_value'] = isset($data['item_value']) ? $data['item_value'] : null;
        $this->container['item_total_value'] = isset($data['item_total_value']) ? $data['item_total_value'] : null;
        $this->container['weight_uom'] = isset($data['weight_uom']) ? $data['weight_uom'] : 'lb';
        $this->container['item_weight'] = isset($data['item_weight']) ? $data['item_weight'] : null;
        $this->container['item_total_weight'] = isset($data['item_total_weight']) ? $data['item_total_weight'] : null;
        $this->container['hs_tariff_number'] = isset($data['hs_tariff_number']) ? $data['hs_tariff_number'] : null;
        $this->container['countryof_origin'] = isset($data['countryof_origin']) ? $data['countryof_origin'] : null;
        $this->container['item_category'] = isset($data['item_category']) ? $data['item_category'] : null;
        $this->container['item_subcategory'] = isset($data['item_subcategory']) ? $data['item_subcategory'] : null;
    }

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

        $allowedValues = $this->getWeightUomAllowableValues();
        if (!is_null($this->container['weight_uom']) && !in_array($this->container['weight_uom'], $allowedValues, true)) {
            $invalidProperties[] = sprintf(
                "invalid value for 'weight_uom', 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 item_description
     *
     * @return string
     */
    public function getItemDescription()
    {
        return $this->container['item_description'];
    }

    /**
     * Sets item_description
     *
     * @param string $item_description Description of the item.  It is important to note that the following descriptions, regardless of case sensitivity, are not considered valid: None, Not Applicable, N/A, Null, Gift, and Merchandise.
     *
     * @return $this
     */
    public function setItemDescription($item_description)
    {
        $this->container['item_description'] = $item_description;

        return $this;
    }

    /**
     * Gets item_quantity
     *
     * @return int
     */
    public function getItemQuantity()
    {
        return $this->container['item_quantity'];
    }

    /**
     * Sets item_quantity
     *
     * @param int $item_quantity Quantity of the item. Integer value required.
     *
     * @return $this
     */
    public function setItemQuantity($item_quantity)
    {
        $this->container['item_quantity'] = $item_quantity;

        return $this;
    }

    /**
     * Gets item_value
     *
     * @return float
     */
    public function getItemValue()
    {
        return $this->container['item_value'];
    }

    /**
     * Sets item_value
     *
     * @param float $item_value Value of the individual item in USD.  Note: This field has been deprecated in favor of itemTotalValue and  will be removed in a future release. Please transition to using itemTotalValue.
     *
     * @return $this
     */
    public function setItemValue($item_value)
    {
        $this->container['item_value'] = $item_value;

        return $this;
    }

    /**
     * Gets item_total_value
     *
     * @return float
     */
    public function getItemTotalValue()
    {
        return $this->container['item_total_value'];
    }

    /**
     * Sets item_total_value
     *
     * @param float $item_total_value The total item value, in USD, of the items matching the `[itemDescription]`.
     *
     * @return $this
     */
    public function setItemTotalValue($item_total_value)
    {
        $this->container['item_total_value'] = $item_total_value;

        return $this;
    }

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

    /**
     * Sets weight_uom
     *
     * @param string $weight_uom Weight Unit of Measurement.   * lb - Pounds
     *
     * @return $this
     */
    public function setWeightUom($weight_uom)
    {
        $allowedValues = $this->getWeightUomAllowableValues();
        if (!is_null($weight_uom) && !in_array($weight_uom, $allowedValues, true)) {
            throw new \InvalidArgumentException(
                sprintf(
                    "Invalid value for 'weight_uom', must be one of '%s'",
                    implode("', '", $allowedValues)
                )
            );
        }
        $this->container['weight_uom'] = $weight_uom;

        return $this;
    }

    /**
     * Gets item_weight
     *
     * @return float
     */
    public function getItemWeight()
    {
        return $this->container['item_weight'];
    }

    /**
     * Sets item_weight
     *
     * @param float $item_weight Provide the weight in weightUOM for the individual item listed with `[itemDescription]`.  Note: This field has been deprecated in favor of itemTotalWeight and  will be removed in a future release. Please transition to using itemTotalWeight.
     *
     * @return $this
     */
    public function setItemWeight($item_weight)
    {
        $this->container['item_weight'] = $item_weight;

        return $this;
    }

    /**
     * Gets item_total_weight
     *
     * @return float
     */
    public function getItemTotalWeight()
    {
        return $this->container['item_total_weight'];
    }

    /**
     * Sets item_total_weight
     *
     * @param float $item_total_weight Provide the total weight in weightUOM for the all the items matching the `[itemDescription]`.
     *
     * @return $this
     */
    public function setItemTotalWeight($item_total_weight)
    {
        $this->container['item_total_weight'] = $item_total_weight;

        return $this;
    }

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

    /**
     * Sets hs_tariff_number
     *
     * @param string $hs_tariff_number For commercial items only. The HS tariff number is based on the Harmonized Commodity Description and Coding System developed by the World Customs Organization.  Providing this value is strongly recommended for faster processing. If not supplied, USPS will attempt to look up the HS tariff number, which may result in longer response times. The value should follow the pattern: `^\\.*(?:[A-Za-z\\d]\\.*){6,14}$`. For more information, see: [https://hts.usitc.gov/current](https://hts.usitc.gov/current).
     *
     * @return $this
     */
    public function setHsTariffNumber($hs_tariff_number)
    {
        $this->container['hs_tariff_number'] = $hs_tariff_number;

        return $this;
    }

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

    /**
     * Sets countryof_origin
     *
     * @param string $countryof_origin 2 digit Alpha Country Code defined by ISO is required for an international address.
     *
     * @return $this
     */
    public function setCountryofOrigin($countryof_origin)
    {
        $this->container['countryof_origin'] = $countryof_origin;

        return $this;
    }

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

    /**
     * Sets item_category
     *
     * @param string $item_category Category of the item being shipped.
     *
     * @return $this
     */
    public function setItemCategory($item_category)
    {
        $this->container['item_category'] = $item_category;

        return $this;
    }

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

    /**
     * Sets item_subcategory
     *
     * @param string $item_subcategory Subcategory of the item being shipped.
     *
     * @return $this
     */
    public function setItemSubcategory($item_subcategory)
    {
        $this->container['item_subcategory'] = $item_subcategory;

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