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

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

use \ArrayAccess;
use \UPS\Locator\ObjectSerializer;

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

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

    /**
      * Array of property to type mappings. Used for (de)serialization
      *
      * @var string[]
      */
    protected static $swaggerTypes = [
        'request' => '\UPS\Locator\Locator\LocatorRequestRequest',
        'origin_address' => '\UPS\Locator\Locator\LocatorRequestOriginAddress',
        'translate' => '\UPS\Locator\Locator\LocatorRequestTranslate',
        'unit_of_measurement' => '\UPS\Locator\Locator\LocatorRequestUnitOfMeasurement',
        'location_id' => 'string[]',
        'location_search_criteria' => '\UPS\Locator\Locator\LocatorRequestLocationSearchCriteria',
        'sort_criteria' => '\UPS\Locator\Locator\LocatorRequestSortCriteria',
        'allow_all_confidence_levels' => 'string',
        'search_option_code' => 'string',
        'service_geo_unit' => '\UPS\Locator\Locator\LocatorRequestServiceGeoUnit',
        'freight_indicator' => 'string'
    ];

    /**
      * Array of property to format mappings. Used for (de)serialization
      *
      * @var string[]
      */
    protected static $swaggerFormats = [
        'request' => null,
        'origin_address' => null,
        'translate' => null,
        'unit_of_measurement' => null,
        'location_id' => null,
        'location_search_criteria' => null,
        'sort_criteria' => null,
        'allow_all_confidence_levels' => null,
        'search_option_code' => null,
        'service_geo_unit' => null,
        'freight_indicator' => 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 = [
        'request' => 'Request',
        'origin_address' => 'OriginAddress',
        'translate' => 'Translate',
        'unit_of_measurement' => 'UnitOfMeasurement',
        'location_id' => 'LocationID',
        'location_search_criteria' => 'LocationSearchCriteria',
        'sort_criteria' => 'SortCriteria',
        'allow_all_confidence_levels' => 'AllowAllConfidenceLevels',
        'search_option_code' => 'SearchOptionCode',
        'service_geo_unit' => 'ServiceGeoUnit',
        'freight_indicator' => 'FreightIndicator'
    ];

    /**
     * Array of attributes to setter functions (for deserialization of responses)
     *
     * @var string[]
     */
    protected static $setters = [
        'request' => 'setRequest',
        'origin_address' => 'setOriginAddress',
        'translate' => 'setTranslate',
        'unit_of_measurement' => 'setUnitOfMeasurement',
        'location_id' => 'setLocationId',
        'location_search_criteria' => 'setLocationSearchCriteria',
        'sort_criteria' => 'setSortCriteria',
        'allow_all_confidence_levels' => 'setAllowAllConfidenceLevels',
        'search_option_code' => 'setSearchOptionCode',
        'service_geo_unit' => 'setServiceGeoUnit',
        'freight_indicator' => 'setFreightIndicator'
    ];

    /**
     * Array of attributes to getter functions (for serialization of requests)
     *
     * @var string[]
     */
    protected static $getters = [
        'request' => 'getRequest',
        'origin_address' => 'getOriginAddress',
        'translate' => 'getTranslate',
        'unit_of_measurement' => 'getUnitOfMeasurement',
        'location_id' => 'getLocationId',
        'location_search_criteria' => 'getLocationSearchCriteria',
        'sort_criteria' => 'getSortCriteria',
        'allow_all_confidence_levels' => 'getAllowAllConfidenceLevels',
        'search_option_code' => 'getSearchOptionCode',
        'service_geo_unit' => 'getServiceGeoUnit',
        'freight_indicator' => 'getFreightIndicator'
    ];

    /**
     * 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['request'] = isset($data['request']) ? $data['request'] : null;
        $this->container['origin_address'] = isset($data['origin_address']) ? $data['origin_address'] : null;
        $this->container['translate'] = isset($data['translate']) ? $data['translate'] : null;
        $this->container['unit_of_measurement'] = isset($data['unit_of_measurement']) ? $data['unit_of_measurement'] : null;
        $this->container['location_id'] = isset($data['location_id']) ? $data['location_id'] : null;
        $this->container['location_search_criteria'] = isset($data['location_search_criteria']) ? $data['location_search_criteria'] : null;
        $this->container['sort_criteria'] = isset($data['sort_criteria']) ? $data['sort_criteria'] : null;
        $this->container['allow_all_confidence_levels'] = isset($data['allow_all_confidence_levels']) ? $data['allow_all_confidence_levels'] : null;
        $this->container['search_option_code'] = isset($data['search_option_code']) ? $data['search_option_code'] : null;
        $this->container['service_geo_unit'] = isset($data['service_geo_unit']) ? $data['service_geo_unit'] : null;
        $this->container['freight_indicator'] = isset($data['freight_indicator']) ? $data['freight_indicator'] : null;
    }

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

        if ($this->container['request'] === null) {
            $invalidProperties[] = "'request' can't be null";
        }
        if ($this->container['origin_address'] === null) {
            $invalidProperties[] = "'origin_address' can't be null";
        }
        if ($this->container['translate'] === null) {
            $invalidProperties[] = "'translate' 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 request
     *
     * @return \UPS\Locator\Locator\LocatorRequestRequest
     */
    public function getRequest()
    {
        return $this->container['request'];
    }

    /**
     * Sets request
     *
     * @param \UPS\Locator\Locator\LocatorRequestRequest $request request
     *
     * @return $this
     */
    public function setRequest($request)
    {
        $this->container['request'] = $request;

        return $this;
    }

    /**
     * Gets origin_address
     *
     * @return \UPS\Locator\Locator\LocatorRequestOriginAddress
     */
    public function getOriginAddress()
    {
        return $this->container['origin_address'];
    }

    /**
     * Sets origin_address
     *
     * @param \UPS\Locator\Locator\LocatorRequestOriginAddress $origin_address origin_address
     *
     * @return $this
     */
    public function setOriginAddress($origin_address)
    {
        $this->container['origin_address'] = $origin_address;

        return $this;
    }

    /**
     * Gets translate
     *
     * @return \UPS\Locator\Locator\LocatorRequestTranslate
     */
    public function getTranslate()
    {
        return $this->container['translate'];
    }

    /**
     * Sets translate
     *
     * @param \UPS\Locator\Locator\LocatorRequestTranslate $translate translate
     *
     * @return $this
     */
    public function setTranslate($translate)
    {
        $this->container['translate'] = $translate;

        return $this;
    }

    /**
     * Gets unit_of_measurement
     *
     * @return \UPS\Locator\Locator\LocatorRequestUnitOfMeasurement
     */
    public function getUnitOfMeasurement()
    {
        return $this->container['unit_of_measurement'];
    }

    /**
     * Sets unit_of_measurement
     *
     * @param \UPS\Locator\Locator\LocatorRequestUnitOfMeasurement $unit_of_measurement unit_of_measurement
     *
     * @return $this
     */
    public function setUnitOfMeasurement($unit_of_measurement)
    {
        $this->container['unit_of_measurement'] = $unit_of_measurement;

        return $this;
    }

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

    /**
     * Sets location_id
     *
     * @param string[] $location_id Location ID is the identification number of the UPS affiliated location.
     *
     * @return $this
     */
    public function setLocationId($location_id)
    {
        $this->container['location_id'] = $location_id;

        return $this;
    }

    /**
     * Gets location_search_criteria
     *
     * @return \UPS\Locator\Locator\LocatorRequestLocationSearchCriteria
     */
    public function getLocationSearchCriteria()
    {
        return $this->container['location_search_criteria'];
    }

    /**
     * Sets location_search_criteria
     *
     * @param \UPS\Locator\Locator\LocatorRequestLocationSearchCriteria $location_search_criteria location_search_criteria
     *
     * @return $this
     */
    public function setLocationSearchCriteria($location_search_criteria)
    {
        $this->container['location_search_criteria'] = $location_search_criteria;

        return $this;
    }

    /**
     * Gets sort_criteria
     *
     * @return \UPS\Locator\Locator\LocatorRequestSortCriteria
     */
    public function getSortCriteria()
    {
        return $this->container['sort_criteria'];
    }

    /**
     * Sets sort_criteria
     *
     * @param \UPS\Locator\Locator\LocatorRequestSortCriteria $sort_criteria sort_criteria
     *
     * @return $this
     */
    public function setSortCriteria($sort_criteria)
    {
        $this->container['sort_criteria'] = $sort_criteria;

        return $this;
    }

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

    /**
     * Sets allow_all_confidence_levels
     *
     * @param string $allow_all_confidence_levels Indicator to allow confidence level in search.
     *
     * @return $this
     */
    public function setAllowAllConfidenceLevels($allow_all_confidence_levels)
    {
        $this->container['allow_all_confidence_levels'] = $allow_all_confidence_levels;

        return $this;
    }

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

    /**
     * Sets search_option_code
     *
     * @param string $search_option_code Valid values:  01-Proximity Search Details 02-Address Search Details 03-Proximity Search Summary 04-Address Search Summary 05-Freight Will Call Search.  Either OptionType 03 or 04 is required.
     *
     * @return $this
     */
    public function setSearchOptionCode($search_option_code)
    {
        $this->container['search_option_code'] = $search_option_code;

        return $this;
    }

    /**
     * Gets service_geo_unit
     *
     * @return \UPS\Locator\Locator\LocatorRequestServiceGeoUnit
     */
    public function getServiceGeoUnit()
    {
        return $this->container['service_geo_unit'];
    }

    /**
     * Sets service_geo_unit
     *
     * @param \UPS\Locator\Locator\LocatorRequestServiceGeoUnit $service_geo_unit service_geo_unit
     *
     * @return $this
     */
    public function setServiceGeoUnit($service_geo_unit)
    {
        $this->container['service_geo_unit'] = $service_geo_unit;

        return $this;
    }

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

    /**
     * Sets freight_indicator
     *
     * @param string $freight_indicator FreightIndicator. Required for Freight Location Search.
     *
     * @return $this
     */
    public function setFreightIndicator($freight_indicator)
    {
        $this->container['freight_indicator'] = $freight_indicator;

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