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

/**
 * PreNotification
 *
 * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
 *
 * 
 * 
 * Generated by: https://github.com/swagger-api/swagger-codegen.git
 * Swagger Codegen version: 3.0.50
 */
/**
 * 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\PreNotification\PreNotification;

use \ArrayAccess;
use \UPS\PreNotification\ObjectSerializer;

/**
 * ShipmentPackage Class Doc Comment
 *
 * @category Class
 * @description Package Information container.
 * @package  UPS\PreNotification
 * @author   Swagger Codegen team
 * @link     https://github.com/swagger-api/swagger-codegen
 */
class ShipmentPackage implements ModelInterface, ArrayAccess
{
    const DISCRIMINATOR = null;

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

    /**
      * Array of property to type mappings. Used for (de)serialization
      *
      * @var string[]
      */
    protected static $swaggerTypes = [
        'tracking_number' => 'string',
        'package_weight' => '\UPS\PreNotification\PreNotification\PackagePackageWeight',
        'transportation_mode' => 'string',
        'void_indicator' => 'string',
        'package_points' => 'string',
        'chemical_record' => '\UPS\PreNotification\PreNotification\PackageChemicalRecord[]'
    ];

    /**
      * Array of property to format mappings. Used for (de)serialization
      *
      * @var string[]
      */
    protected static $swaggerFormats = [
        'tracking_number' => null,
        'package_weight' => null,
        'transportation_mode' => null,
        'void_indicator' => null,
        'package_points' => null,
        'chemical_record' => 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 = [
        'tracking_number' => 'TrackingNumber',
        'package_weight' => 'PackageWeight',
        'transportation_mode' => 'TransportationMode',
        'void_indicator' => 'VoidIndicator',
        'package_points' => 'PackagePoints',
        'chemical_record' => 'ChemicalRecord'
    ];

    /**
     * Array of attributes to setter functions (for deserialization of responses)
     *
     * @var string[]
     */
    protected static $setters = [
        'tracking_number' => 'setTrackingNumber',
        'package_weight' => 'setPackageWeight',
        'transportation_mode' => 'setTransportationMode',
        'void_indicator' => 'setVoidIndicator',
        'package_points' => 'setPackagePoints',
        'chemical_record' => 'setChemicalRecord'
    ];

    /**
     * Array of attributes to getter functions (for serialization of requests)
     *
     * @var string[]
     */
    protected static $getters = [
        'tracking_number' => 'getTrackingNumber',
        'package_weight' => 'getPackageWeight',
        'transportation_mode' => 'getTransportationMode',
        'void_indicator' => 'getVoidIndicator',
        'package_points' => 'getPackagePoints',
        'chemical_record' => 'getChemicalRecord'
    ];

    /**
     * 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['tracking_number'] = isset($data['tracking_number']) ? $data['tracking_number'] : null;
        $this->container['package_weight'] = isset($data['package_weight']) ? $data['package_weight'] : null;
        $this->container['transportation_mode'] = isset($data['transportation_mode']) ? $data['transportation_mode'] : null;
        $this->container['void_indicator'] = isset($data['void_indicator']) ? $data['void_indicator'] : null;
        $this->container['package_points'] = isset($data['package_points']) ? $data['package_points'] : null;
        $this->container['chemical_record'] = isset($data['chemical_record']) ? $data['chemical_record'] : null;
    }

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

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

    /**
     * Sets tracking_number
     *
     * @param string $tracking_number The packages tracking number.
     *
     * @return $this
     */
    public function setTrackingNumber($tracking_number)
    {
        $this->container['tracking_number'] = $tracking_number;

        return $this;
    }

    /**
     * Gets package_weight
     *
     * @return \UPS\PreNotification\PreNotification\PackagePackageWeight
     */
    public function getPackageWeight()
    {
        return $this->container['package_weight'];
    }

    /**
     * Sets package_weight
     *
     * @param \UPS\PreNotification\PreNotification\PackagePackageWeight $package_weight package_weight
     *
     * @return $this
     */
    public function setPackageWeight($package_weight)
    {
        $this->container['package_weight'] = $package_weight;

        return $this;
    }

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

    /**
     * Sets transportation_mode
     *
     * @param string $transportation_mode Declares that a package was prepared according to ground, passenger aircraft, or cargo aircraft only. Only required when the CommodityRegulatedLevelCode is FR or LQ.  Valid entries include: GND, CAO, PAX.
     *
     * @return $this
     */
    public function setTransportationMode($transportation_mode)
    {
        $this->container['transportation_mode'] = $transportation_mode;

        return $this;
    }

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

    /**
     * Sets void_indicator
     *
     * @param string $void_indicator Indicator to specify that a Dangerous Goods package is voided. True if VoidIndicator tag exists; false otherwise.
     *
     * @return $this
     */
    public function setVoidIndicator($void_indicator)
    {
        $this->container['void_indicator'] = $void_indicator;

        return $this;
    }

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

    /**
     * Sets package_points
     *
     * @param string $package_points Regulated Commodity Transport Package Score Quantity
     *
     * @return $this
     */
    public function setPackagePoints($package_points)
    {
        $this->container['package_points'] = $package_points;

        return $this;
    }

    /**
     * Gets chemical_record
     *
     * @return \UPS\PreNotification\PreNotification\PackageChemicalRecord[]
     */
    public function getChemicalRecord()
    {
        return $this->container['chemical_record'];
    }

    /**
     * Sets chemical_record
     *
     * @param \UPS\PreNotification\PreNotification\PackageChemicalRecord[] $chemical_record chemical_record
     *
     * @return $this
     */
    public function setChemicalRecord($chemical_record)
    {
        $this->container['chemical_record'] = $chemical_record;

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