<?php
/**
 * PackageResultsShippingLabel
 *
 * PHP version 5
 *
 * @category Class
 * @package  UPS\Shipping
 * @author   Swagger Codegen team
 * @link     https://github.com/swagger-api/swagger-codegen
 */

/**
 * Ship
 *
 * The Shipping Package API gives the application many ways to manage the shipment of packages to their destination. # Reference - <a href=\"https://developer.ups.com/api/reference/shipping/business-rules\" target=\"_blank\" rel=\"noopener\">Business Rules</a> - <a href=\"https://developer.ups.com/api/reference/shipping/appendix1\" target=\"_blank\" rel=\"noopener\">Appendix 1</a> - <a href=\"https://developer.ups.com/api/reference/shipping/appendix2\" target=\"_blank\" rel=\"noopener\">Appendix 2</a> - <a href=\"https://developer.ups.com/api/reference/shipping/errors\" target=\"_blank\" rel=\"noopener\">Errors</a> - <a href=\"https://developer.ups.com/api/reference/shipping/faq\" target=\"_blank\" rel=\"noopener\">FAQ</a> - <a href=\"https://developer.ups.com/api/reference/shipping/best-practices\" target=\"_blank\" rel=\"noopener noreferrer\"> Best Practices</a>  <br/><p>Try out UPS APIs with example requests using Postman. Explore API documentation and sample applications through GitHub.</p>  <a href=\"https://god.gw.postman.com/run-collection/29542085-af2f70b3-405b-4aee-af8d-1eb715e4cebc?action=collection%2Ffork&source=rip_markdown&collection-url=entityId%3D29542085-af2f70b3-405b-4aee-af8d-1eb715e4cebc%26entityType%3Dcollection%26workspaceId%3D7e7595f0-4829-4f9a-aee1-75c126b9d417\" target=\"_blank\" rel=\"noopener noreferrer\">   <img src=\"https://run.pstmn.io/button.svg\" alt=\"Run In Postman\" style=\"width: 128px; height: 32px;\"></a> <a href=\"https://github.com/UPS-API\" target=\"_blank\" rel=\"noopener noreferrer\">   <img src=\"https://www.ups.com/assets/resources/webcontent/images/gitHubButton.svg\" alt=\"Open in GitHub \" style=\"width: 128px; height: 32px;\"> </a>
 *
 * 
 * 
 * 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 UPS\Shipping\Shipping;

use \ArrayAccess;
use \UPS\Shipping\ObjectSerializer;

/**
 * PackageResultsShippingLabel Class Doc Comment
 *
 * @category Class
 * @description The container for UPS shipping label. Returned for following shipments - Forward shipments, Shipments with PRL returns service,  Electronic Return Label or Electronic Import Control Label shipments with SubVersion greater than or equal to 1707. Shipping label wont be returned if BarCodeImageIndicator is present.
 * @package  UPS\Shipping
 * @author   Swagger Codegen team
 * @link     https://github.com/swagger-api/swagger-codegen
 */
class PackageResultsShippingLabel implements ModelInterface, ArrayAccess
{
    const DISCRIMINATOR = null;

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

    /**
      * Array of property to type mappings. Used for (de)serialization
      *
      * @var string[]
      */
    protected static $swaggerTypes = [
        'image_format' => '\UPS\Shipping\Shipping\ShippingLabelImageFormat',
        'graphic_image' => 'string',
        'graphic_image_part' => 'string[]',
        'international_signature_graphic_image' => 'string',
        'html_image' => 'string',
        'pdf417' => 'string'
    ];

    /**
      * Array of property to format mappings. Used for (de)serialization
      *
      * @var string[]
      */
    protected static $swaggerFormats = [
        'image_format' => null,
        'graphic_image' => null,
        'graphic_image_part' => null,
        'international_signature_graphic_image' => null,
        'html_image' => null,
        'pdf417' => 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_format' => 'ImageFormat',
        'graphic_image' => 'GraphicImage',
        'graphic_image_part' => 'GraphicImagePart',
        'international_signature_graphic_image' => 'InternationalSignatureGraphicImage',
        'html_image' => 'HTMLImage',
        'pdf417' => 'PDF417'
    ];

    /**
     * Array of attributes to setter functions (for deserialization of responses)
     *
     * @var string[]
     */
    protected static $setters = [
        'image_format' => 'setImageFormat',
        'graphic_image' => 'setGraphicImage',
        'graphic_image_part' => 'setGraphicImagePart',
        'international_signature_graphic_image' => 'setInternationalSignatureGraphicImage',
        'html_image' => 'setHtmlImage',
        'pdf417' => 'setPdf417'
    ];

    /**
     * Array of attributes to getter functions (for serialization of requests)
     *
     * @var string[]
     */
    protected static $getters = [
        'image_format' => 'getImageFormat',
        'graphic_image' => 'getGraphicImage',
        'graphic_image_part' => 'getGraphicImagePart',
        'international_signature_graphic_image' => 'getInternationalSignatureGraphicImage',
        'html_image' => 'getHtmlImage',
        'pdf417' => 'getPdf417'
    ];

    /**
     * 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;
    }



    /**
     * 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_format'] = isset($data['image_format']) ? $data['image_format'] : null;
        $this->container['graphic_image'] = isset($data['graphic_image']) ? $data['graphic_image'] : null;
        $this->container['graphic_image_part'] = isset($data['graphic_image_part']) ? $data['graphic_image_part'] : null;
        $this->container['international_signature_graphic_image'] = isset($data['international_signature_graphic_image']) ? $data['international_signature_graphic_image'] : null;
        $this->container['html_image'] = isset($data['html_image']) ? $data['html_image'] : null;
        $this->container['pdf417'] = isset($data['pdf417']) ? $data['pdf417'] : null;
    }

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

        if ($this->container['image_format'] === null) {
            $invalidProperties[] = "'image_format' can't be null";
        }
        if ($this->container['graphic_image'] === null) {
            $invalidProperties[] = "'graphic_image' 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 image_format
     *
     * @return \UPS\Shipping\Shipping\ShippingLabelImageFormat
     */
    public function getImageFormat()
    {
        return $this->container['image_format'];
    }

    /**
     * Sets image_format
     *
     * @param \UPS\Shipping\Shipping\ShippingLabelImageFormat $image_format image_format
     *
     * @return $this
     */
    public function setImageFormat($image_format)
    {
        $this->container['image_format'] = $image_format;

        return $this;
    }

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

    /**
     * Sets graphic_image
     *
     * @param string $graphic_image Base 64 encoded graphic image.
     *
     * @return $this
     */
    public function setGraphicImage($graphic_image)
    {
        $this->container['graphic_image'] = $graphic_image;

        return $this;
    }

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

    /**
     * Sets graphic_image_part
     *
     * @param string[] $graphic_image_part Base 64 encoded graphic image. Applicable only for Mail Innovations CN22 Combination Forward Label with more than 3 commodities.  **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1.
     *
     * @return $this
     */
    public function setGraphicImagePart($graphic_image_part)
    {
        $this->container['graphic_image_part'] = $graphic_image_part;

        return $this;
    }

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

    /**
     * Sets international_signature_graphic_image
     *
     * @param string $international_signature_graphic_image Base 64 encoded graphic image of the Warsaw text and signature box. EPL2, ZPL and SPL labels. The image will be returned for non-US based shipments. One image will be given per shipment and it will be in the first PackageResults container.
     *
     * @return $this
     */
    public function setInternationalSignatureGraphicImage($international_signature_graphic_image)
    {
        $this->container['international_signature_graphic_image'] = $international_signature_graphic_image;

        return $this;
    }

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

    /**
     * Sets html_image
     *
     * @param string $html_image Base 64 encoded html browser image rendering software. This is only returned for gif and png image formats.
     *
     * @return $this
     */
    public function setHtmlImage($html_image)
    {
        $this->container['html_image'] = $html_image;

        return $this;
    }

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

    /**
     * Sets pdf417
     *
     * @param string $pdf417 PDF-417 is a two-dimensional barcode, which can store up to about 1,800 printable ASCII characters or 1,100 binary characters per symbol. The symbol is rectangular. The image is Base 64 encoded and returned if the LabelImageFormat code is GIF. Shipment with PRL return service only.
     *
     * @return $this
     */
    public function setPdf417($pdf417)
    {
        $this->container['pdf417'] = $pdf417;

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