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

/**
 * CustomsForm Class Doc Comment
 *
 * @category Class
 * @description Additional details required when creating International shipments.
 * @package  USPS\InternationalLabels
 * @author   Swagger Codegen team
 * @link     https://github.com/swagger-api/swagger-codegen
 */
class CustomsForm implements ModelInterface, ArrayAccess
{
    const DISCRIMINATOR = null;

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

    /**
      * Array of property to type mappings. Used for (de)serialization
      *
      * @var string[]
      */
    protected static $swaggerTypes = [
        'content_comments' => 'string',
        'restriction_type' => 'string',
        'restriction_comments' => 'string',
        'aesitn' => 'string',
        'invoice_number' => 'string',
        'license_number' => 'string',
        'certificate_number' => 'string'
    ];

    /**
      * Array of property to format mappings. Used for (de)serialization
      *
      * @var string[]
      */
    protected static $swaggerFormats = [
        'content_comments' => null,
        'restriction_type' => null,
        'restriction_comments' => null,
        'aesitn' => null,
        'invoice_number' => null,
        'license_number' => null,
        'certificate_number' => 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 = [
        'content_comments' => 'contentComments',
        'restriction_type' => 'restrictionType',
        'restriction_comments' => 'restrictionComments',
        'aesitn' => 'AESITN',
        'invoice_number' => 'invoiceNumber',
        'license_number' => 'licenseNumber',
        'certificate_number' => 'certificateNumber'
    ];

    /**
     * Array of attributes to setter functions (for deserialization of responses)
     *
     * @var string[]
     */
    protected static $setters = [
        'content_comments' => 'setContentComments',
        'restriction_type' => 'setRestrictionType',
        'restriction_comments' => 'setRestrictionComments',
        'aesitn' => 'setAesitn',
        'invoice_number' => 'setInvoiceNumber',
        'license_number' => 'setLicenseNumber',
        'certificate_number' => 'setCertificateNumber'
    ];

    /**
     * Array of attributes to getter functions (for serialization of requests)
     *
     * @var string[]
     */
    protected static $getters = [
        'content_comments' => 'getContentComments',
        'restriction_type' => 'getRestrictionType',
        'restriction_comments' => 'getRestrictionComments',
        'aesitn' => 'getAesitn',
        'invoice_number' => 'getInvoiceNumber',
        'license_number' => 'getLicenseNumber',
        'certificate_number' => 'getCertificateNumber'
    ];

    /**
     * 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 RESTRICTION_TYPE_QUARANTINE = 'QUARANTINE';
    const RESTRICTION_TYPE_SANITARY_INSPECTION = 'SANITARY_INSPECTION';
    const RESTRICTION_TYPE_PHYTOSANITARY_INSPECTION = 'PHYTOSANITARY_INSPECTION';
    const RESTRICTION_TYPE_OTHER = 'OTHER';

    /**
     * Gets allowable values of the enum
     *
     * @return string[]
     */
    public function getRestrictionTypeAllowableValues()
    {
        return [
            self::RESTRICTION_TYPE_QUARANTINE,
            self::RESTRICTION_TYPE_SANITARY_INSPECTION,
            self::RESTRICTION_TYPE_PHYTOSANITARY_INSPECTION,
            self::RESTRICTION_TYPE_OTHER,
        ];
    }

    /**
     * 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['content_comments'] = isset($data['content_comments']) ? $data['content_comments'] : null;
        $this->container['restriction_type'] = isset($data['restriction_type']) ? $data['restriction_type'] : null;
        $this->container['restriction_comments'] = isset($data['restriction_comments']) ? $data['restriction_comments'] : null;
        $this->container['aesitn'] = isset($data['aesitn']) ? $data['aesitn'] : null;
        $this->container['invoice_number'] = isset($data['invoice_number']) ? $data['invoice_number'] : null;
        $this->container['license_number'] = isset($data['license_number']) ? $data['license_number'] : null;
        $this->container['certificate_number'] = isset($data['certificate_number']) ? $data['certificate_number'] : null;
    }

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

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

    /**
     * Sets content_comments
     *
     * @param string $content_comments Required when customContentType is OTHER.
     *
     * @return $this
     */
    public function setContentComments($content_comments)
    {
        $this->container['content_comments'] = $content_comments;

        return $this;
    }

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

    /**
     * Sets restriction_type
     *
     * @param string $restriction_type Restriction Types.   * QUARANTINE   * SANITARY_INSPECTION   * PHYTOSANITARY_INSPECTION   * OTHER
     *
     * @return $this
     */
    public function setRestrictionType($restriction_type)
    {
        $allowedValues = $this->getRestrictionTypeAllowableValues();
        if (!is_null($restriction_type) && !in_array($restriction_type, $allowedValues, true)) {
            throw new \InvalidArgumentException(
                sprintf(
                    "Invalid value for 'restriction_type', must be one of '%s'",
                    implode("', '", $allowedValues)
                )
            );
        }
        $this->container['restriction_type'] = $restriction_type;

        return $this;
    }

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

    /**
     * Sets restriction_comments
     *
     * @param string $restriction_comments Restriction Comments.  Required when `restrictionType`=`OTHER`.
     *
     * @return $this
     */
    public function setRestrictionComments($restriction_comments)
    {
        $this->container['restriction_comments'] = $restriction_comments;

        return $this;
    }

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

    /**
     * Sets aesitn
     *
     * @param string $aesitn USPS requires the ITN **_or_** the Exemption.  * **AES - Automated Export System /   ITN - Internal Transaction Number**\\   The [internal transaction number (ITN)](https://pe.usps.com/text/imm/immc5_010.htm) is a 14-digit number that corresponds to an export transaction in the Automated Export System. It serves as proof that an exporter met his or her legal obligation to inform the U.S. government about the details of an export shipment. * **EEL- Exemptions, Exclusions, Legend**\\   An [AES exemption](https://pe.usps.com/text/imm/immc5_012.htm) is an instance in which you would not have to file in AES to get the 14-digit ITN. Instead of the ITN, you would enter the exemption’s section in the U.S. Foreign Trade Regulations on the export documentation where you would otherwise put the ITN.  Sample - `NO EEI 30.37(a)`: Shipments valued at $2,500 or less.
     *
     * @return $this
     */
    public function setAesitn($aesitn)
    {
        $this->container['aesitn'] = $aesitn;

        return $this;
    }

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

    /**
     * Sets invoice_number
     *
     * @param string $invoice_number Invoice Number.
     *
     * @return $this
     */
    public function setInvoiceNumber($invoice_number)
    {
        $this->container['invoice_number'] = $invoice_number;

        return $this;
    }

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

    /**
     * Sets license_number
     *
     * @param string $license_number License Number.
     *
     * @return $this
     */
    public function setLicenseNumber($license_number)
    {
        $this->container['license_number'] = $license_number;

        return $this;
    }

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

    /**
     * Sets certificate_number
     *
     * @param string $certificate_number Certificate Number.
     *
     * @return $this
     */
    public function setCertificateNumber($certificate_number)
    {
        $this->container['certificate_number'] = $certificate_number;

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