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

/**
 * Pickup
 *
 * 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\Pickup\Pickup;

use \ArrayAccess;
use \UPS\Pickup\ObjectSerializer;

/**
 * PickupCreationResponseRateResult Class Doc Comment
 *
 * @category Class
 * @description The result of rating on-callpickup. It correlates to rate status code 01
 * @package  UPS\Pickup
 * @author   Swagger Codegen team
 * @link     https://github.com/swagger-api/swagger-codegen
 */
class PickupCreationResponseRateResult implements ModelInterface, ArrayAccess
{
    const DISCRIMINATOR = null;

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

    /**
      * Array of property to type mappings. Used for (de)serialization
      *
      * @var string[]
      */
    protected static $swaggerTypes = [
        'disclaimer' => '\UPS\Pickup\Pickup\RateResultDisclaimer',
        'rate_type' => 'string',
        'currency_code' => 'string',
        'charge_detail' => '\UPS\Pickup\Pickup\RateResultChargeDetail[]',
        'tax_charges' => '\UPS\Pickup\Pickup\RateResultTaxCharges[]',
        'total_tax' => 'string',
        'grand_total_of_all_charge' => 'string',
        'grand_total_of_all_incented_charge' => 'string',
        'pre_tax_total_charge' => 'string',
        'pre_tax_total_incented_charge' => 'string'
    ];

    /**
      * Array of property to format mappings. Used for (de)serialization
      *
      * @var string[]
      */
    protected static $swaggerFormats = [
        'disclaimer' => null,
        'rate_type' => null,
        'currency_code' => null,
        'charge_detail' => null,
        'tax_charges' => null,
        'total_tax' => null,
        'grand_total_of_all_charge' => null,
        'grand_total_of_all_incented_charge' => null,
        'pre_tax_total_charge' => null,
        'pre_tax_total_incented_charge' => 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 = [
        'disclaimer' => 'Disclaimer',
        'rate_type' => 'RateType',
        'currency_code' => 'CurrencyCode',
        'charge_detail' => 'ChargeDetail',
        'tax_charges' => 'TaxCharges',
        'total_tax' => 'TotalTax',
        'grand_total_of_all_charge' => 'GrandTotalOfAllCharge',
        'grand_total_of_all_incented_charge' => 'GrandTotalOfAllIncentedCharge',
        'pre_tax_total_charge' => 'PreTaxTotalCharge',
        'pre_tax_total_incented_charge' => 'PreTaxTotalIncentedCharge'
    ];

    /**
     * Array of attributes to setter functions (for deserialization of responses)
     *
     * @var string[]
     */
    protected static $setters = [
        'disclaimer' => 'setDisclaimer',
        'rate_type' => 'setRateType',
        'currency_code' => 'setCurrencyCode',
        'charge_detail' => 'setChargeDetail',
        'tax_charges' => 'setTaxCharges',
        'total_tax' => 'setTotalTax',
        'grand_total_of_all_charge' => 'setGrandTotalOfAllCharge',
        'grand_total_of_all_incented_charge' => 'setGrandTotalOfAllIncentedCharge',
        'pre_tax_total_charge' => 'setPreTaxTotalCharge',
        'pre_tax_total_incented_charge' => 'setPreTaxTotalIncentedCharge'
    ];

    /**
     * Array of attributes to getter functions (for serialization of requests)
     *
     * @var string[]
     */
    protected static $getters = [
        'disclaimer' => 'getDisclaimer',
        'rate_type' => 'getRateType',
        'currency_code' => 'getCurrencyCode',
        'charge_detail' => 'getChargeDetail',
        'tax_charges' => 'getTaxCharges',
        'total_tax' => 'getTotalTax',
        'grand_total_of_all_charge' => 'getGrandTotalOfAllCharge',
        'grand_total_of_all_incented_charge' => 'getGrandTotalOfAllIncentedCharge',
        'pre_tax_total_charge' => 'getPreTaxTotalCharge',
        'pre_tax_total_incented_charge' => 'getPreTaxTotalIncentedCharge'
    ];

    /**
     * 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['disclaimer'] = isset($data['disclaimer']) ? $data['disclaimer'] : null;
        $this->container['rate_type'] = isset($data['rate_type']) ? $data['rate_type'] : null;
        $this->container['currency_code'] = isset($data['currency_code']) ? $data['currency_code'] : null;
        $this->container['charge_detail'] = isset($data['charge_detail']) ? $data['charge_detail'] : null;
        $this->container['tax_charges'] = isset($data['tax_charges']) ? $data['tax_charges'] : null;
        $this->container['total_tax'] = isset($data['total_tax']) ? $data['total_tax'] : null;
        $this->container['grand_total_of_all_charge'] = isset($data['grand_total_of_all_charge']) ? $data['grand_total_of_all_charge'] : null;
        $this->container['grand_total_of_all_incented_charge'] = isset($data['grand_total_of_all_incented_charge']) ? $data['grand_total_of_all_incented_charge'] : null;
        $this->container['pre_tax_total_charge'] = isset($data['pre_tax_total_charge']) ? $data['pre_tax_total_charge'] : null;
        $this->container['pre_tax_total_incented_charge'] = isset($data['pre_tax_total_incented_charge']) ? $data['pre_tax_total_incented_charge'] : null;
    }

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

        if ($this->container['grand_total_of_all_charge'] === null) {
            $invalidProperties[] = "'grand_total_of_all_charge' 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 disclaimer
     *
     * @return \UPS\Pickup\Pickup\RateResultDisclaimer
     */
    public function getDisclaimer()
    {
        return $this->container['disclaimer'];
    }

    /**
     * Sets disclaimer
     *
     * @param \UPS\Pickup\Pickup\RateResultDisclaimer $disclaimer disclaimer
     *
     * @return $this
     */
    public function setDisclaimer($disclaimer)
    {
        $this->container['disclaimer'] = $disclaimer;

        return $this;
    }

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

    /**
     * Sets rate_type
     *
     * @param string $rate_type Indicates this pickup is rated as same-day or future-day pickup. - SD = Same-day Pickup - FD = Future-day Pickup
     *
     * @return $this
     */
    public function setRateType($rate_type)
    {
        $this->container['rate_type'] = $rate_type;

        return $this;
    }

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

    /**
     * Sets currency_code
     *
     * @param string $currency_code IATA currency codes for the pickup charge. Such as USD
     *
     * @return $this
     */
    public function setCurrencyCode($currency_code)
    {
        $this->container['currency_code'] = $currency_code;

        return $this;
    }

    /**
     * Gets charge_detail
     *
     * @return \UPS\Pickup\Pickup\RateResultChargeDetail[]
     */
    public function getChargeDetail()
    {
        return $this->container['charge_detail'];
    }

    /**
     * Sets charge_detail
     *
     * @param \UPS\Pickup\Pickup\RateResultChargeDetail[] $charge_detail Container to hold taxes when, detailed taxes are request via RateTaxIndicator.  **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 setChargeDetail($charge_detail)
    {
        $this->container['charge_detail'] = $charge_detail;

        return $this;
    }

    /**
     * Gets tax_charges
     *
     * @return \UPS\Pickup\Pickup\RateResultTaxCharges[]
     */
    public function getTaxCharges()
    {
        return $this->container['tax_charges'];
    }

    /**
     * Sets tax_charges
     *
     * @param \UPS\Pickup\Pickup\RateResultTaxCharges[] $tax_charges Container to hold taxes when, detailed taxes are request via RateTaxIndicator.  **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 setTaxCharges($tax_charges)
    {
        $this->container['tax_charges'] = $tax_charges;

        return $this;
    }

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

    /**
     * Sets total_tax
     *
     * @param string $total_tax The sum of all taxes.
     *
     * @return $this
     */
    public function setTotalTax($total_tax)
    {
        $this->container['total_tax'] = $total_tax;

        return $this;
    }

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

    /**
     * Sets grand_total_of_all_charge
     *
     * @param string $grand_total_of_all_charge The grand total of each charge and applied tax.
     *
     * @return $this
     */
    public function setGrandTotalOfAllCharge($grand_total_of_all_charge)
    {
        $this->container['grand_total_of_all_charge'] = $grand_total_of_all_charge;

        return $this;
    }

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

    /**
     * Sets grand_total_of_all_incented_charge
     *
     * @param string $grand_total_of_all_incented_charge The grand total of each incented charge and applied tax. Only present if 1. UserLevelDiscountIndicator = Y and User Level Promotion is applied to the pickup or 2 .if any incentive rate is applied to the pickup and SubVersion on the request is greater than or equal to 1707.
     *
     * @return $this
     */
    public function setGrandTotalOfAllIncentedCharge($grand_total_of_all_incented_charge)
    {
        $this->container['grand_total_of_all_incented_charge'] = $grand_total_of_all_incented_charge;

        return $this;
    }

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

    /**
     * Sets pre_tax_total_charge
     *
     * @param string $pre_tax_total_charge Total of charges before taxes. Only present when tax details requested in input.
     *
     * @return $this
     */
    public function setPreTaxTotalCharge($pre_tax_total_charge)
    {
        $this->container['pre_tax_total_charge'] = $pre_tax_total_charge;

        return $this;
    }

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

    /**
     * Sets pre_tax_total_incented_charge
     *
     * @param string $pre_tax_total_incented_charge Total of incented charges before taxes. Only present if 1. UserLevelDiscountIndicator = Y and User Level Promotion is applied to the pickup or 2 .if any incentive rate is applied to the pickup and SubVersion on the request is greater than or equal to 1707.
     *
     * @return $this
     */
    public function setPreTaxTotalIncentedCharge($pre_tax_total_incented_charge)
    {
        $this->container['pre_tax_total_incented_charge'] = $pre_tax_total_incented_charge;

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