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

/**
 * ImageInfo Class Doc Comment
 *
 * @category Class
 * @description The Image Object defines label characteristics
 * @package  USPS\InternationalLabels
 * @author   Swagger Codegen team
 * @link     https://github.com/swagger-api/swagger-codegen
 */
class ImageInfo implements ModelInterface, ArrayAccess
{
    const DISCRIMINATOR = null;

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

    /**
      * Array of property to type mappings. Used for (de)serialization
      *
      * @var string[]
      */
    protected static $swaggerTypes = [
        'image_type' => 'string',
        'label_type' => 'string',
        'hold_for_manifest' => 'bool',
        'suppress_postage' => 'bool',
        'include_label_broker_pdf' => 'bool',
        'add_zpl_comments' => 'bool'
    ];

    /**
      * Array of property to format mappings. Used for (de)serialization
      *
      * @var string[]
      */
    protected static $swaggerFormats = [
        'image_type' => null,
        'label_type' => null,
        'hold_for_manifest' => null,
        'suppress_postage' => null,
        'include_label_broker_pdf' => null,
        'add_zpl_comments' => 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 = [
        'image_type' => 'imageType',
        'label_type' => 'labelType',
        'hold_for_manifest' => 'holdForManifest',
        'suppress_postage' => 'suppressPostage',
        'include_label_broker_pdf' => 'includeLabelBrokerPDF',
        'add_zpl_comments' => 'addZPLComments'
    ];

    /**
     * Array of attributes to setter functions (for deserialization of responses)
     *
     * @var string[]
     */
    protected static $setters = [
        'image_type' => 'setImageType',
        'label_type' => 'setLabelType',
        'hold_for_manifest' => 'setHoldForManifest',
        'suppress_postage' => 'setSuppressPostage',
        'include_label_broker_pdf' => 'setIncludeLabelBrokerPdf',
        'add_zpl_comments' => 'setAddZplComments'
    ];

    /**
     * Array of attributes to getter functions (for serialization of requests)
     *
     * @var string[]
     */
    protected static $getters = [
        'image_type' => 'getImageType',
        'label_type' => 'getLabelType',
        'hold_for_manifest' => 'getHoldForManifest',
        'suppress_postage' => 'getSuppressPostage',
        'include_label_broker_pdf' => 'getIncludeLabelBrokerPdf',
        'add_zpl_comments' => 'getAddZplComments'
    ];

    /**
     * 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 IMAGE_TYPE_LABEL_BROKER = 'LABEL_BROKER';
    const IMAGE_TYPE_PDF = 'PDF';
    const IMAGE_TYPE_TIFF = 'TIFF';
    const IMAGE_TYPE_ZPL203_DPI = 'ZPL203DPI';
    const IMAGE_TYPE_ZPL300_DPI = 'ZPL300DPI';
    const IMAGE_TYPE_NONE = 'NONE';
    const LABEL_TYPE__4_X6_LABEL = '4X6LABEL';

    /**
     * Gets allowable values of the enum
     *
     * @return string[]
     */
    public function getImageTypeAllowableValues()
    {
        return [
            self::IMAGE_TYPE_LABEL_BROKER,
            self::IMAGE_TYPE_PDF,
            self::IMAGE_TYPE_TIFF,
            self::IMAGE_TYPE_ZPL203_DPI,
            self::IMAGE_TYPE_ZPL300_DPI,
            self::IMAGE_TYPE_NONE,
        ];
    }
    /**
     * Gets allowable values of the enum
     *
     * @return string[]
     */
    public function getLabelTypeAllowableValues()
    {
        return [
            self::LABEL_TYPE__4_X6_LABEL,
        ];
    }

    /**
     * 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['image_type'] = isset($data['image_type']) ? $data['image_type'] : 'PDF';
        $this->container['label_type'] = isset($data['label_type']) ? $data['label_type'] : '4X6LABEL';
        $this->container['hold_for_manifest'] = isset($data['hold_for_manifest']) ? $data['hold_for_manifest'] : false;
        $this->container['suppress_postage'] = isset($data['suppress_postage']) ? $data['suppress_postage'] : false;
        $this->container['include_label_broker_pdf'] = isset($data['include_label_broker_pdf']) ? $data['include_label_broker_pdf'] : false;
        $this->container['add_zpl_comments'] = isset($data['add_zpl_comments']) ? $data['add_zpl_comments'] : false;
    }

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

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

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

    /**
     * Sets image_type
     *
     * @param string $image_type The type of label image requested.  * 'LABEL_BROKER'- Request a USPS QR code to allow your customers with no access to a printer to print at participating Post Office Locations. All USPS API users and third party integrators utilizing QR codes are subject to the [Label Broker terms and conditions](https://www.usps.com/terms-conditions/label-broker.htm). For more information please see the Label Broker guide available on [GitHub](https://github.com/USPS/api-examples/blob/main/USPS%20APIs%20Domestic%20Labels%20API%20Documentation_2023_0901%20Published.pdf).  * 'PDF'  * 'TIFF'  * 'ZPL203DPI'  * 'ZPL300DPI'  * 'NONE'
     *
     * @return $this
     */
    public function setImageType($image_type)
    {
        $allowedValues = $this->getImageTypeAllowableValues();
        if (!is_null($image_type) && !in_array($image_type, $allowedValues, true)) {
            throw new \InvalidArgumentException(
                sprintf(
                    "Invalid value for 'image_type', must be one of '%s'",
                    implode("', '", $allowedValues)
                )
            );
        }
        $this->container['image_type'] = $image_type;

        return $this;
    }

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

    /**
     * Sets label_type
     *
     * @param string $label_type The requested label image size to generate.
     *
     * @return $this
     */
    public function setLabelType($label_type)
    {
        $allowedValues = $this->getLabelTypeAllowableValues();
        if (!is_null($label_type) && !in_array($label_type, $allowedValues, true)) {
            throw new \InvalidArgumentException(
                sprintf(
                    "Invalid value for 'label_type', must be one of '%s'",
                    implode("', '", $allowedValues)
                )
            );
        }
        $this->container['label_type'] = $label_type;

        return $this;
    }

    /**
     * Gets hold_for_manifest
     *
     * @return bool
     */
    public function getHoldForManifest()
    {
        return $this->container['hold_for_manifest'];
    }

    /**
     * Sets hold_for_manifest
     *
     * @param bool $hold_for_manifest This field is deprecated and will be removed in a future release. By default, all international packages are manifested at the end of the day. Use `packageDescription.packageOptions.immediateManifest` to trigger an immediate manifest.
     *
     * @return $this
     */
    public function setHoldForManifest($hold_for_manifest)
    {
        $this->container['hold_for_manifest'] = $hold_for_manifest;

        return $this;
    }

    /**
     * Gets suppress_postage
     *
     * @return bool
     */
    public function getSuppressPostage()
    {
        return $this->container['suppress_postage'];
    }

    /**
     * Sets suppress_postage
     *
     * @param bool $suppress_postage Indicates if Insured Fees and Postal Charges/Fees should be omitted from the label image.  If true, Insured Fees and Postal Charges/Fees values will be removed.
     *
     * @return $this
     */
    public function setSuppressPostage($suppress_postage)
    {
        $this->container['suppress_postage'] = $suppress_postage;

        return $this;
    }

    /**
     * Gets include_label_broker_pdf
     *
     * @return bool
     */
    public function getIncludeLabelBrokerPdf()
    {
        return $this->container['include_label_broker_pdf'];
    }

    /**
     * Sets include_label_broker_pdf
     *
     * @param bool $include_label_broker_pdf Applicable only when `imageType` is `LABEL_BROKER`. When `includeLabelBrokerPDF` is `true`, two label images will be returned in the multi-part and vendor response as `labelBrokerQR` and `labelImage`. `labelBrokerQR` will contain the base64 PNG of the Label Broker QR Code and `labelImage` will contain the base64 PDF of the Label stored in Label Broker. When `includeLabelBrokerPDF` is `false`, one image will be returned in the multi-part and vendor response as `labelImage` as the base64 PNG of the Label Broker QR Code.
     *
     * @return $this
     */
    public function setIncludeLabelBrokerPdf($include_label_broker_pdf)
    {
        $this->container['include_label_broker_pdf'] = $include_label_broker_pdf;

        return $this;
    }

    /**
     * Gets add_zpl_comments
     *
     * @return bool
     */
    public function getAddZplComments()
    {
        return $this->container['add_zpl_comments'];
    }

    /**
     * Sets add_zpl_comments
     *
     * @param bool $add_zpl_comments Applicable only when `imageType` is `ZPL203DPI` or `ZPL300DPI`.  When `addZPLComments` is `true`, comments will be visible within the ZPL text response to the user to denote different sections of their label.  When `addZPLComments` is `false`, no comments will be included in the ZPL text response.  This will be ignored for any other `imageType`.  Example of a ZPL comment:  `^FX Start of label. 123e4567-e89b-12d3-a456-426614174000 ^FS`
     *
     * @return $this
     */
    public function setAddZplComments($add_zpl_comments)
    {
        $this->container['add_zpl_comments'] = $add_zpl_comments;

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