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

/**
 * 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; Labels API allows you to digitally create mailing labels for the following mail classes: USPS Ground Advantage&#8482;, Parcel Select&#174; Destination Entry, Parcel Select Lightweight&#174;, USPS Connect&#174; Local, USPS Connect&#174; Regional, Priority  Mail&#174;, Priority Mail Express&#174;, Bound Printed Matter, Library Mail, and Media Mail&#174;.  * Use the [Getting Started guide](https://developers.usps.com/getting-started) to get started with the Labels API. * The USPS&#174; 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).  **Manifest Scheduling**   The following table outlines the Domestic Label manifesting schedule for specific conditions listed below.   | Condition                   | Scheduling | | ----------------------------| -------- | | **Customs Forms labels**    | 12:30am CT on the day after label creation. | | **Return labels**    | 12:30am CT on the day after label creation. | | **Smart Locker labels**     | Electronic data is sent to Postal systems within 15 minutes of label creation. | | **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 after the `mailingDate` value provided by the user |
 *
 * OpenAPI spec version: 3.9.9
 * 
 * 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\Labels\Model;

use \ArrayAccess;
use \USPS\Labels\ObjectSerializer;

/**
 * LabelRequest Class Doc Comment
 *
 * @category Class
 * @description Destination address of the recipient. Used in pricing as the destination ZIP Code&amp;#8482;.
 * @package  USPS\Labels
 * @author   Swagger Codegen team
 * @link     https://github.com/swagger-api/swagger-codegen
 */
class LabelRequest implements ModelInterface, ArrayAccess
{
    const DISCRIMINATOR = null;

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

    /**
      * Array of property to type mappings. Used for (de)serialization
      *
      * @var string[]
      */
    protected static $swaggerTypes = [
        'image_info' => 'AllOfLabelRequestImageInfo',
        'to_address' => '\USPS\Labels\Model\DomesticLabelToAddress',
        'from_address' => '\USPS\Labels\Model\DomesticLabelAddress',
        'sender_address' => '\USPS\Labels\Model\DomesticLabelSenderAddress',
        'return_address' => 'AllOfLabelRequestReturnAddress',
        'package_description' => 'OneOfLabelRequestPackageDescription',
        'customs_form' => '\USPS\Labels\Model\DomesticCustomsForm'
    ];

    /**
      * Array of property to format mappings. Used for (de)serialization
      *
      * @var string[]
      */
    protected static $swaggerFormats = [
        'image_info' => null,
        'to_address' => null,
        'from_address' => null,
        'sender_address' => null,
        'return_address' => null,
        'package_description' => null,
        'customs_form' => 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_info' => 'imageInfo',
        'to_address' => 'toAddress',
        'from_address' => 'fromAddress',
        'sender_address' => 'senderAddress',
        'return_address' => 'returnAddress',
        'package_description' => 'packageDescription',
        'customs_form' => 'customsForm'
    ];

    /**
     * Array of attributes to setter functions (for deserialization of responses)
     *
     * @var string[]
     */
    protected static $setters = [
        'image_info' => 'setImageInfo',
        'to_address' => 'setToAddress',
        'from_address' => 'setFromAddress',
        'sender_address' => 'setSenderAddress',
        'return_address' => 'setReturnAddress',
        'package_description' => 'setPackageDescription',
        'customs_form' => 'setCustomsForm'
    ];

    /**
     * Array of attributes to getter functions (for serialization of requests)
     *
     * @var string[]
     */
    protected static $getters = [
        'image_info' => 'getImageInfo',
        'to_address' => 'getToAddress',
        'from_address' => 'getFromAddress',
        'sender_address' => 'getSenderAddress',
        'return_address' => 'getReturnAddress',
        'package_description' => 'getPackageDescription',
        'customs_form' => 'getCustomsForm'
    ];

    /**
     * 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_info'] = isset($data['image_info']) ? $data['image_info'] : null;
        $this->container['to_address'] = isset($data['to_address']) ? $data['to_address'] : null;
        $this->container['from_address'] = isset($data['from_address']) ? $data['from_address'] : null;
        $this->container['sender_address'] = isset($data['sender_address']) ? $data['sender_address'] : null;
        $this->container['return_address'] = isset($data['return_address']) ? $data['return_address'] : null;
        $this->container['package_description'] = isset($data['package_description']) ? $data['package_description'] : null;
        $this->container['customs_form'] = isset($data['customs_form']) ? $data['customs_form'] : null;
    }

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

        if ($this->container['to_address'] === null) {
            $invalidProperties[] = "'to_address' can't be null";
        }
        if ($this->container['from_address'] === null) {
            $invalidProperties[] = "'from_address' can't be null";
        }
        if ($this->container['package_description'] === null) {
            $invalidProperties[] = "'package_description' 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_info
     *
     * @return AllOfLabelRequestImageInfo
     */
    public function getImageInfo()
    {
        return $this->container['image_info'];
    }

    /**
     * Sets image_info
     *
     * @param AllOfLabelRequestImageInfo $image_info Image Information
     *
     * @return $this
     */
    public function setImageInfo($image_info)
    {
        $this->container['image_info'] = $image_info;

        return $this;
    }

    /**
     * Gets to_address
     *
     * @return \USPS\Labels\Model\DomesticLabelToAddress
     */
    public function getToAddress()
    {
        return $this->container['to_address'];
    }

    /**
     * Sets to_address
     *
     * @param \USPS\Labels\Model\DomesticLabelToAddress $to_address to_address
     *
     * @return $this
     */
    public function setToAddress($to_address)
    {
        $this->container['to_address'] = $to_address;

        return $this;
    }

    /**
     * Gets from_address
     *
     * @return \USPS\Labels\Model\DomesticLabelAddress
     */
    public function getFromAddress()
    {
        return $this->container['from_address'];
    }

    /**
     * Sets from_address
     *
     * @param \USPS\Labels\Model\DomesticLabelAddress $from_address from_address
     *
     * @return $this
     */
    public function setFromAddress($from_address)
    {
        $this->container['from_address'] = $from_address;

        return $this;
    }

    /**
     * Gets sender_address
     *
     * @return \USPS\Labels\Model\DomesticLabelSenderAddress
     */
    public function getSenderAddress()
    {
        return $this->container['sender_address'];
    }

    /**
     * Sets sender_address
     *
     * @param \USPS\Labels\Model\DomesticLabelSenderAddress $sender_address sender_address
     *
     * @return $this
     */
    public function setSenderAddress($sender_address)
    {
        $this->container['sender_address'] = $sender_address;

        return $this;
    }

    /**
     * Gets return_address
     *
     * @return AllOfLabelRequestReturnAddress
     */
    public function getReturnAddress()
    {
        return $this->container['return_address'];
    }

    /**
     * Sets return_address
     *
     * @param AllOfLabelRequestReturnAddress $return_address The address where the package should be returned to if it is deemed undeliverable or returned to sender. This address will be printed in the return address block of the label.  Note: * The First and Last Name or Firm Name are always required.
     *
     * @return $this
     */
    public function setReturnAddress($return_address)
    {
        $this->container['return_address'] = $return_address;

        return $this;
    }

    /**
     * Gets package_description
     *
     * @return OneOfLabelRequestPackageDescription
     */
    public function getPackageDescription()
    {
        return $this->container['package_description'];
    }

    /**
     * Sets package_description
     *
     * @param OneOfLabelRequestPackageDescription $package_description Package description
     *
     * @return $this
     */
    public function setPackageDescription($package_description)
    {
        $this->container['package_description'] = $package_description;

        return $this;
    }

    /**
     * Gets customs_form
     *
     * @return \USPS\Labels\Model\DomesticCustomsForm
     */
    public function getCustomsForm()
    {
        return $this->container['customs_form'];
    }

    /**
     * Sets customs_form
     *
     * @param \USPS\Labels\Model\DomesticCustomsForm $customs_form customs_form
     *
     * @return $this
     */
    public function setCustomsForm($customs_form)
    {
        $this->container['customs_form'] = $customs_form;

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