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

/**
 * InternationalLabelMetadata Class Doc Comment
 *
 * @category Class
 * @description Metadata information for an international label including tracking number, pricing details, postage, and extra services.
 * @package  USPS\InternationalLabels
 * @author   Swagger Codegen team
 * @link     https://github.com/swagger-api/swagger-codegen
 */
class InternationalLabelMetadata implements ModelInterface, ArrayAccess
{
    const DISCRIMINATOR = null;

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

    /**
      * Array of property to type mappings. Used for (de)serialization
      *
      * @var string[]
      */
    protected static $swaggerTypes = [
        'label_address' => '\USPS\InternationalLabels\Model\InternationalLabelAddress',
        'international_tracking_number' => 'string',
        'construct_code' => 'string',
        'sku' => 'string',
        'postage' => 'float',
        'extra_services' => '\USPS\InternationalLabels\Model\InternationalLabelMetadataExtraServices[]',
        'international_price_group' => 'string',
        'weight_uom' => 'string',
        'weight' => '\USPS\InternationalLabels\Model\Weight',
        'dimensional_weight' => 'string',
        'mailing_date' => '\DateTime',
        'fees' => '\USPS\InternationalLabels\Model\InternationalLabelMetadataFees[]',
        'label_broker_id' => 'string'
    ];

    /**
      * Array of property to format mappings. Used for (de)serialization
      *
      * @var string[]
      */
    protected static $swaggerFormats = [
        'label_address' => null,
        'international_tracking_number' => null,
        'construct_code' => null,
        'sku' => null,
        'postage' => null,
        'extra_services' => null,
        'international_price_group' => null,
        'weight_uom' => null,
        'weight' => null,
        'dimensional_weight' => null,
        'mailing_date' => 'date',
        'fees' => null,
        'label_broker_id' => 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 = [
        'label_address' => 'labelAddress',
        'international_tracking_number' => 'internationalTrackingNumber',
        'construct_code' => 'constructCode',
        'sku' => 'SKU',
        'postage' => 'postage',
        'extra_services' => 'extraServices',
        'international_price_group' => 'internationalPriceGroup',
        'weight_uom' => 'weightUOM',
        'weight' => 'weight',
        'dimensional_weight' => 'dimensionalWeight',
        'mailing_date' => 'mailingDate',
        'fees' => 'fees',
        'label_broker_id' => 'labelBrokerID'
    ];

    /**
     * Array of attributes to setter functions (for deserialization of responses)
     *
     * @var string[]
     */
    protected static $setters = [
        'label_address' => 'setLabelAddress',
        'international_tracking_number' => 'setInternationalTrackingNumber',
        'construct_code' => 'setConstructCode',
        'sku' => 'setSku',
        'postage' => 'setPostage',
        'extra_services' => 'setExtraServices',
        'international_price_group' => 'setInternationalPriceGroup',
        'weight_uom' => 'setWeightUom',
        'weight' => 'setWeight',
        'dimensional_weight' => 'setDimensionalWeight',
        'mailing_date' => 'setMailingDate',
        'fees' => 'setFees',
        'label_broker_id' => 'setLabelBrokerId'
    ];

    /**
     * Array of attributes to getter functions (for serialization of requests)
     *
     * @var string[]
     */
    protected static $getters = [
        'label_address' => 'getLabelAddress',
        'international_tracking_number' => 'getInternationalTrackingNumber',
        'construct_code' => 'getConstructCode',
        'sku' => 'getSku',
        'postage' => 'getPostage',
        'extra_services' => 'getExtraServices',
        'international_price_group' => 'getInternationalPriceGroup',
        'weight_uom' => 'getWeightUom',
        'weight' => 'getWeight',
        'dimensional_weight' => 'getDimensionalWeight',
        'mailing_date' => 'getMailingDate',
        'fees' => 'getFees',
        'label_broker_id' => 'getLabelBrokerId'
    ];

    /**
     * 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['label_address'] = isset($data['label_address']) ? $data['label_address'] : null;
        $this->container['international_tracking_number'] = isset($data['international_tracking_number']) ? $data['international_tracking_number'] : null;
        $this->container['construct_code'] = isset($data['construct_code']) ? $data['construct_code'] : null;
        $this->container['sku'] = isset($data['sku']) ? $data['sku'] : null;
        $this->container['postage'] = isset($data['postage']) ? $data['postage'] : null;
        $this->container['extra_services'] = isset($data['extra_services']) ? $data['extra_services'] : null;
        $this->container['international_price_group'] = isset($data['international_price_group']) ? $data['international_price_group'] : null;
        $this->container['weight_uom'] = isset($data['weight_uom']) ? $data['weight_uom'] : 'lb';
        $this->container['weight'] = isset($data['weight']) ? $data['weight'] : null;
        $this->container['dimensional_weight'] = isset($data['dimensional_weight']) ? $data['dimensional_weight'] : null;
        $this->container['mailing_date'] = isset($data['mailing_date']) ? $data['mailing_date'] : null;
        $this->container['fees'] = isset($data['fees']) ? $data['fees'] : null;
        $this->container['label_broker_id'] = isset($data['label_broker_id']) ? $data['label_broker_id'] : 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 label_address
     *
     * @return \USPS\InternationalLabels\Model\InternationalLabelAddress
     */
    public function getLabelAddress()
    {
        return $this->container['label_address'];
    }

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

        return $this;
    }

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

    /**
     * Sets international_tracking_number
     *
     * @param string $international_tracking_number International Package Tracking number
     *
     * @return $this
     */
    public function setInternationalTrackingNumber($international_tracking_number)
    {
        $this->container['international_tracking_number'] = $international_tracking_number;

        return $this;
    }

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

    /**
     * Sets construct_code
     *
     * @param string $construct_code The barcode construct code associated with the international tracking number
     *
     * @return $this
     */
    public function setConstructCode($construct_code)
    {
        $this->container['construct_code'] = $construct_code;

        return $this;
    }

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

    /**
     * Sets sku
     *
     * @param string $sku Pricing SKU
     *
     * @return $this
     */
    public function setSku($sku)
    {
        $this->container['sku'] = $sku;

        return $this;
    }

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

    /**
     * Sets postage
     *
     * @param float $postage Amount of Postage Required, does not include insurance or other extra service fees.
     *
     * @return $this
     */
    public function setPostage($postage)
    {
        $this->container['postage'] = $postage;

        return $this;
    }

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

    /**
     * Sets extra_services
     *
     * @param \USPS\InternationalLabels\Model\InternationalLabelMetadataExtraServices[] $extra_services Extra services requested on the package.
     *
     * @return $this
     */
    public function setExtraServices($extra_services)
    {
        $this->container['extra_services'] = $extra_services;

        return $this;
    }

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

    /**
     * Sets international_price_group
     *
     * @param string $international_price_group Indicates the price group for a given `countryISOAlpha2Code`, `mailClass`, `mailingDate`, and `rateIndicator`.
     *
     * @return $this
     */
    public function setInternationalPriceGroup($international_price_group)
    {
        $this->container['international_price_group'] = $international_price_group;

        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 weight
     *
     * @return \USPS\InternationalLabels\Model\Weight
     */
    public function getWeight()
    {
        return $this->container['weight'];
    }

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

        return $this;
    }

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

    /**
     * Sets dimensional_weight
     *
     * @param string $dimensional_weight The dimensional weight of the package in pounds, if greater than the value specified in `weight`.
     *
     * @return $this
     */
    public function setDimensionalWeight($dimensional_weight)
    {
        $this->container['dimensional_weight'] = $dimensional_weight;

        return $this;
    }

    /**
     * Gets mailing_date
     *
     * @return \DateTime
     */
    public function getMailingDate()
    {
        return $this->container['mailing_date'];
    }

    /**
     * Sets mailing_date
     *
     * @param \DateTime $mailing_date The date on which the package will be mailed as provided in the request.
     *
     * @return $this
     */
    public function setMailingDate($mailing_date)
    {
        $this->container['mailing_date'] = $mailing_date;

        return $this;
    }

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

    /**
     * Sets fees
     *
     * @param \USPS\InternationalLabels\Model\InternationalLabelMetadataFees[] $fees Fees associated to the package.
     *
     * @return $this
     */
    public function setFees($fees)
    {
        $this->container['fees'] = $fees;

        return $this;
    }

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

    /**
     * Sets label_broker_id
     *
     * @param string $label_broker_id Unique Label Broker ID that can be used as an alternative to the Label Broker QR Code to retrieve the label at a Post Office. Will only be provided when an imageType of LABEL_BROKER is requested.
     *
     * @return $this
     */
    public function setLabelBrokerId($label_broker_id)
    {
        $this->container['label_broker_id'] = $label_broker_id;

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