<?php
/**
 * FreightWillCallSearchFacilityAddress
 *
 * 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;

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

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

    /**
      * Array of property to type mappings. Used for (de)serialization
      *
      * @var string[]
      */
    protected static $swaggerTypes = [
        'slic' => 'string',
        'address_line' => 'string[]',
        'city' => 'string',
        'postal_code_primary_low' => 'string',
        'postal_code_extended_low' => 'string',
        'state' => 'string',
        'country_code' => 'string'
    ];

    /**
      * Array of property to format mappings. Used for (de)serialization
      *
      * @var string[]
      */
    protected static $swaggerFormats = [
        'slic' => null,
        'address_line' => null,
        'city' => null,
        'postal_code_primary_low' => null,
        'postal_code_extended_low' => null,
        'state' => null,
        'country_code' => 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 = [
        'slic' => 'SLIC',
        'address_line' => 'AddressLine',
        'city' => 'City',
        'postal_code_primary_low' => 'PostalCodePrimaryLow',
        'postal_code_extended_low' => 'PostalCodeExtendedLow',
        'state' => 'State',
        'country_code' => 'CountryCode'
    ];

    /**
     * Array of attributes to setter functions (for deserialization of responses)
     *
     * @var string[]
     */
    protected static $setters = [
        'slic' => 'setSlic',
        'address_line' => 'setAddressLine',
        'city' => 'setCity',
        'postal_code_primary_low' => 'setPostalCodePrimaryLow',
        'postal_code_extended_low' => 'setPostalCodeExtendedLow',
        'state' => 'setState',
        'country_code' => 'setCountryCode'
    ];

    /**
     * Array of attributes to getter functions (for serialization of requests)
     *
     * @var string[]
     */
    protected static $getters = [
        'slic' => 'getSlic',
        'address_line' => 'getAddressLine',
        'city' => 'getCity',
        'postal_code_primary_low' => 'getPostalCodePrimaryLow',
        'postal_code_extended_low' => 'getPostalCodeExtendedLow',
        'state' => 'getState',
        'country_code' => 'getCountryCode'
    ];

    /**
     * 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['slic'] = isset($data['slic']) ? $data['slic'] : null;
        $this->container['address_line'] = isset($data['address_line']) ? $data['address_line'] : null;
        $this->container['city'] = isset($data['city']) ? $data['city'] : null;
        $this->container['postal_code_primary_low'] = isset($data['postal_code_primary_low']) ? $data['postal_code_primary_low'] : null;
        $this->container['postal_code_extended_low'] = isset($data['postal_code_extended_low']) ? $data['postal_code_extended_low'] : null;
        $this->container['state'] = isset($data['state']) ? $data['state'] : null;
        $this->container['country_code'] = isset($data['country_code']) ? $data['country_code'] : null;
    }

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

        if ($this->container['country_code'] === null) {
            $invalidProperties[] = "'country_code' 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 slic
     *
     * @return string
     */
    public function getSlic()
    {
        return $this->container['slic'];
    }

    /**
     * Sets slic
     *
     * @param string $slic Facility SLIC. Required for Freight Will call search if FreightWillCallRequestType is 2.
     *
     * @return $this
     */
    public function setSlic($slic)
    {
        $this->container['slic'] = $slic;

        return $this;
    }

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

    /**
     * Sets address_line
     *
     * @param string[] $address_line Address line
     *
     * @return $this
     */
    public function setAddressLine($address_line)
    {
        $this->container['address_line'] = $address_line;

        return $this;
    }

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

    /**
     * Sets city
     *
     * @param string $city City. Required for Freight Will call search if FreightWillCallRequestType is 3.
     *
     * @return $this
     */
    public function setCity($city)
    {
        $this->container['city'] = $city;

        return $this;
    }

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

    /**
     * Sets postal_code_primary_low
     *
     * @param string $postal_code_primary_low Postal code. Required for Freight Will call search if FreightWillCallRequestType is 1.
     *
     * @return $this
     */
    public function setPostalCodePrimaryLow($postal_code_primary_low)
    {
        $this->container['postal_code_primary_low'] = $postal_code_primary_low;

        return $this;
    }

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

    /**
     * Sets postal_code_extended_low
     *
     * @param string $postal_code_extended_low 4 Digit postal code extension. Valid for US only.
     *
     * @return $this
     */
    public function setPostalCodeExtendedLow($postal_code_extended_low)
    {
        $this->container['postal_code_extended_low'] = $postal_code_extended_low;

        return $this;
    }

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

    /**
     * Sets state
     *
     * @param string $state State. Required if FrieghtWillCallRequestType is 3 if State is available.
     *
     * @return $this
     */
    public function setState($state)
    {
        $this->container['state'] = $state;

        return $this;
    }

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

    /**
     * Sets country_code
     *
     * @param string $country_code Country or territory code.
     *
     * @return $this
     */
    public function setCountryCode($country_code)
    {
        $this->container['country_code'] = $country_code;

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