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

/**
 * InternationalCustomsForm Class Doc Comment
 *
 * @category Class
 * @description Customs form information required for international shipments including content type, item details, and references.
 * @package  USPS\InternationalLabels
 * @author   Swagger Codegen team
 * @link     https://github.com/swagger-api/swagger-codegen
 */
class InternationalCustomsForm extends CustomsForm 
{
    const DISCRIMINATOR = null;

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

    /**
      * Array of property to type mappings. Used for (de)serialization
      *
      * @var string[]
      */
    protected static $swaggerTypes = [
        'customs_content_type' => 'string',
        'importers_reference' => '\USPS\InternationalLabels\Model\CustomsReference',
        'exporters_reference' => '\USPS\InternationalLabels\Model\CustomsReference',
        'contents' => '\USPS\InternationalLabels\Model\InternationalShippingContents[]'
    ];

    /**
      * Array of property to format mappings. Used for (de)serialization
      *
      * @var string[]
      */
    protected static $swaggerFormats = [
        'customs_content_type' => null,
        'importers_reference' => null,
        'exporters_reference' => null,
        'contents' => 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 = [
        'customs_content_type' => 'customsContentType',
        'importers_reference' => 'importersReference',
        'exporters_reference' => 'exportersReference',
        'contents' => 'contents'
    ];

    /**
     * Array of attributes to setter functions (for deserialization of responses)
     *
     * @var string[]
     */
    protected static $setters = [
        'customs_content_type' => 'setCustomsContentType',
        'importers_reference' => 'setImportersReference',
        'exporters_reference' => 'setExportersReference',
        'contents' => 'setContents'
    ];

    /**
     * Array of attributes to getter functions (for serialization of requests)
     *
     * @var string[]
     */
    protected static $getters = [
        'customs_content_type' => 'getCustomsContentType',
        'importers_reference' => 'getImportersReference',
        'exporters_reference' => 'getExportersReference',
        'contents' => 'getContents'
    ];

    /**
     * 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 CUSTOMS_CONTENT_TYPE_MERCHANDISE = 'MERCHANDISE';
    const CUSTOMS_CONTENT_TYPE_GIFT = 'GIFT';
    const CUSTOMS_CONTENT_TYPE_DOCUMENT = 'DOCUMENT';
    const CUSTOMS_CONTENT_TYPE_COMMERCIAL_SAMPLE = 'COMMERCIAL_SAMPLE';
    const CUSTOMS_CONTENT_TYPE_RETURNED_GOODS = 'RETURNED_GOODS';
    const CUSTOMS_CONTENT_TYPE_OTHER = 'OTHER';
    const CUSTOMS_CONTENT_TYPE_HUMANITARIAN_DONATIONS = 'HUMANITARIAN_DONATIONS';
    const CUSTOMS_CONTENT_TYPE_DANGEROUS_GOODS = 'DANGEROUS_GOODS';
    const CUSTOMS_CONTENT_TYPE_CREMATED_REMAINS = 'CREMATED_REMAINS';
    const CUSTOMS_CONTENT_TYPE_NON_NEGOTIABLE_DOCUMENT = 'NON_NEGOTIABLE_DOCUMENT';
    const CUSTOMS_CONTENT_TYPE_MEDICAL_SUPPLIES = 'MEDICAL_SUPPLIES';
    const CUSTOMS_CONTENT_TYPE_PHARMACEUTICALS = 'PHARMACEUTICALS';

    /**
     * Gets allowable values of the enum
     *
     * @return string[]
     */
    public function getCustomsContentTypeAllowableValues()
    {
        return [
            self::CUSTOMS_CONTENT_TYPE_MERCHANDISE,
            self::CUSTOMS_CONTENT_TYPE_GIFT,
            self::CUSTOMS_CONTENT_TYPE_DOCUMENT,
            self::CUSTOMS_CONTENT_TYPE_COMMERCIAL_SAMPLE,
            self::CUSTOMS_CONTENT_TYPE_RETURNED_GOODS,
            self::CUSTOMS_CONTENT_TYPE_OTHER,
            self::CUSTOMS_CONTENT_TYPE_HUMANITARIAN_DONATIONS,
            self::CUSTOMS_CONTENT_TYPE_DANGEROUS_GOODS,
            self::CUSTOMS_CONTENT_TYPE_CREMATED_REMAINS,
            self::CUSTOMS_CONTENT_TYPE_NON_NEGOTIABLE_DOCUMENT,
            self::CUSTOMS_CONTENT_TYPE_MEDICAL_SUPPLIES,
            self::CUSTOMS_CONTENT_TYPE_PHARMACEUTICALS,
        ];
    }


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

        $this->container['customs_content_type'] = isset($data['customs_content_type']) ? $data['customs_content_type'] : null;
        $this->container['importers_reference'] = isset($data['importers_reference']) ? $data['importers_reference'] : null;
        $this->container['exporters_reference'] = isset($data['exporters_reference']) ? $data['exporters_reference'] : null;
        $this->container['contents'] = isset($data['contents']) ? $data['contents'] : null;
    }

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

        if ($this->container['customs_content_type'] === null) {
            $invalidProperties[] = "'customs_content_type' can't be null";
        }
        $allowedValues = $this->getCustomsContentTypeAllowableValues();
        if (!is_null($this->container['customs_content_type']) && !in_array($this->container['customs_content_type'], $allowedValues, true)) {
            $invalidProperties[] = sprintf(
                "invalid value for 'customs_content_type', must be one of '%s'",
                implode("', '", $allowedValues)
            );
        }

        if ($this->container['contents'] === null) {
            $invalidProperties[] = "'contents' can't be null";
        }
        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 customs_content_type
     *
     * @return string
     */
    public function getCustomsContentType()
    {
        return $this->container['customs_content_type'];
    }

    /**
     * Sets customs_content_type
     *
     * @param string $customs_content_type Specifies the content of the package or envelope.  Note:  * `CREMATED_REMAINS` is only supported by mailClass `PRIORITY_MAIL_EXPRESS_INTERNATIONAL` * Customs Content Type must be `DANGEROUS_GOODS` when using any of the following extra services:   * 813 - HAZMAT Class 7 - Radioactive Materials Package   * 826 - HAZMAT Division 6.2 – Infectious Substances Package
     *
     * @return $this
     */
    public function setCustomsContentType($customs_content_type)
    {
        $allowedValues = $this->getCustomsContentTypeAllowableValues();
        if (!in_array($customs_content_type, $allowedValues, true)) {
            throw new \InvalidArgumentException(
                sprintf(
                    "Invalid value for 'customs_content_type', must be one of '%s'",
                    implode("', '", $allowedValues)
                )
            );
        }
        $this->container['customs_content_type'] = $customs_content_type;

        return $this;
    }

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

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

        return $this;
    }

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

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

        return $this;
    }

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

    /**
     * Sets contents
     *
     * @param \USPS\InternationalLabels\Model\InternationalShippingContents[] $contents Details of the contents of the package. The first five items will print on the label of the customs form, and the rest will print on a separate continuation page.  Note: - One of either `itemValue` and `itemWeight` or `itemTotalValue` and `itemTotalWeight` are required.
     *
     * @return $this
     */
    public function setContents($contents)
    {
        $this->container['contents'] = $contents;

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