<?php
/**
 * Outlet
 *
 * PHP version 8.1
 *
 * @category Class
 * @package  Vend202601
 * @author   OpenAPI Generator team
 * @link     https://openapi-generator.tech
 */

/**
 * API 2026-01
 *
 * Lightspeed Retail (X-Series) API.
 *
 * The version of the OpenAPI document: 2026-01
 * Contact: x-series.api@lightspeedhq.com
 * Generated by: https://openapi-generator.tech
 * Generator version: 7.20.0
 */

/**
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 * https://openapi-generator.tech
 * Do not edit the class manually.
 */

namespace Vend202601\Model;

use \ArrayAccess;
use \Vend202601\ObjectSerializer;

/**
 * Outlet Class Doc Comment
 *
 * @category Class
 * @package  Vend202601
 * @author   OpenAPI Generator team
 * @link     https://openapi-generator.tech
 * @implements \ArrayAccess<string, mixed>
 */
class Outlet implements ModelInterface, ArrayAccess, \JsonSerializable
{
    public const DISCRIMINATOR = null;

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

    /**
      * Array of property to type mappings. Used for (de)serialization
      *
      * @var string[]
      */
    protected static $openAPITypes = [
        'attributes' => '\Vend202601\Model\Attribute[]',
        'currency' => 'string',
        'currency_symbol' => 'string',
        'default_tax_id' => 'string',
        'deleted_at' => 'string',
        'display_prices' => 'string',
        'email' => 'string',
        'id' => 'string',
        'name' => 'string',
        'physical_address_1' => 'string',
        'physical_address_2' => 'string',
        'physical_city' => 'string',
        'physical_country_id' => 'string',
        'physical_postcode' => 'string',
        'physical_state' => 'string',
        'physical_suburb' => 'string',
        'time_zone' => 'string',
        'version' => 'int'
    ];

    /**
      * Array of property to format mappings. Used for (de)serialization
      *
      * @var string[]
      * @phpstan-var array<string, string|null>
      * @psalm-var array<string, string|null>
      */
    protected static $openAPIFormats = [
        'attributes' => null,
        'currency' => null,
        'currency_symbol' => null,
        'default_tax_id' => null,
        'deleted_at' => null,
        'display_prices' => null,
        'email' => null,
        'id' => null,
        'name' => null,
        'physical_address_1' => null,
        'physical_address_2' => null,
        'physical_city' => null,
        'physical_country_id' => null,
        'physical_postcode' => null,
        'physical_state' => null,
        'physical_suburb' => null,
        'time_zone' => null,
        'version' => 'int64'
    ];

    /**
      * Array of nullable properties. Used for (de)serialization
      *
      * @var boolean[]
      */
    protected static array $openAPINullables = [
        'attributes' => false,
        'currency' => false,
        'currency_symbol' => false,
        'default_tax_id' => false,
        'deleted_at' => true,
        'display_prices' => false,
        'email' => false,
        'id' => false,
        'name' => false,
        'physical_address_1' => false,
        'physical_address_2' => false,
        'physical_city' => false,
        'physical_country_id' => false,
        'physical_postcode' => false,
        'physical_state' => false,
        'physical_suburb' => false,
        'time_zone' => false,
        'version' => false
    ];

    /**
      * If a nullable field gets set to null, insert it here
      *
      * @var boolean[]
      */
    protected array $openAPINullablesSetToNull = [];

    /**
     * Array of property to type mappings. Used for (de)serialization
     *
     * @return array
     */
    public static function openAPITypes()
    {
        return self::$openAPITypes;
    }

    /**
     * Array of property to format mappings. Used for (de)serialization
     *
     * @return array
     */
    public static function openAPIFormats()
    {
        return self::$openAPIFormats;
    }

    /**
     * Array of nullable properties
     *
     * @return array
     */
    protected static function openAPINullables(): array
    {
        return self::$openAPINullables;
    }

    /**
     * Array of nullable field names deliberately set to null
     *
     * @return boolean[]
     */
    private function getOpenAPINullablesSetToNull(): array
    {
        return $this->openAPINullablesSetToNull;
    }

    /**
     * Setter - Array of nullable field names deliberately set to null
     *
     * @param boolean[] $openAPINullablesSetToNull
     */
    private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
    {
        $this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
    }

    /**
     * Checks if a property is nullable
     *
     * @param string $property
     * @return bool
     */
    public static function isNullable(string $property): bool
    {
        return self::openAPINullables()[$property] ?? false;
    }

    /**
     * Checks if a nullable property is set to null.
     *
     * @param string $property
     * @return bool
     */
    public function isNullableSetToNull(string $property): bool
    {
        return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
    }

    /**
     * Array of attributes where the key is the local name,
     * and the value is the original name
     *
     * @var string[]
     */
    protected static $attributeMap = [
        'attributes' => 'attributes',
        'currency' => 'currency',
        'currency_symbol' => 'currency_symbol',
        'default_tax_id' => 'default_tax_id',
        'deleted_at' => 'deleted_at',
        'display_prices' => 'display_prices',
        'email' => 'email',
        'id' => 'id',
        'name' => 'name',
        'physical_address_1' => 'physical_address_1',
        'physical_address_2' => 'physical_address_2',
        'physical_city' => 'physical_city',
        'physical_country_id' => 'physical_country_id',
        'physical_postcode' => 'physical_postcode',
        'physical_state' => 'physical_state',
        'physical_suburb' => 'physical_suburb',
        'time_zone' => 'time_zone',
        'version' => 'version'
    ];

    /**
     * Array of attributes to setter functions (for deserialization of responses)
     *
     * @var string[]
     */
    protected static $setters = [
        'attributes' => 'setAttributes',
        'currency' => 'setCurrency',
        'currency_symbol' => 'setCurrencySymbol',
        'default_tax_id' => 'setDefaultTaxId',
        'deleted_at' => 'setDeletedAt',
        'display_prices' => 'setDisplayPrices',
        'email' => 'setEmail',
        'id' => 'setId',
        'name' => 'setName',
        'physical_address_1' => 'setPhysicalAddress1',
        'physical_address_2' => 'setPhysicalAddress2',
        'physical_city' => 'setPhysicalCity',
        'physical_country_id' => 'setPhysicalCountryId',
        'physical_postcode' => 'setPhysicalPostcode',
        'physical_state' => 'setPhysicalState',
        'physical_suburb' => 'setPhysicalSuburb',
        'time_zone' => 'setTimeZone',
        'version' => 'setVersion'
    ];

    /**
     * Array of attributes to getter functions (for serialization of requests)
     *
     * @var string[]
     */
    protected static $getters = [
        'attributes' => 'getAttributes',
        'currency' => 'getCurrency',
        'currency_symbol' => 'getCurrencySymbol',
        'default_tax_id' => 'getDefaultTaxId',
        'deleted_at' => 'getDeletedAt',
        'display_prices' => 'getDisplayPrices',
        'email' => 'getEmail',
        'id' => 'getId',
        'name' => 'getName',
        'physical_address_1' => 'getPhysicalAddress1',
        'physical_address_2' => 'getPhysicalAddress2',
        'physical_city' => 'getPhysicalCity',
        'physical_country_id' => 'getPhysicalCountryId',
        'physical_postcode' => 'getPhysicalPostcode',
        'physical_state' => 'getPhysicalState',
        'physical_suburb' => 'getPhysicalSuburb',
        'time_zone' => 'getTimeZone',
        'version' => 'getVersion'
    ];

    /**
     * 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::$openAPIModelName;
    }


    /**
     * Associative array for storing property values
     *
     * @var mixed[]
     */
    protected $container = [];

    /**
     * Constructor
     *
     * @param mixed[]|null $data Associated array of property values
     *                      initializing the model
     */
    public function __construct(?array $data = null)
    {
        $this->setIfExists('attributes', $data ?? [], null);
        $this->setIfExists('currency', $data ?? [], null);
        $this->setIfExists('currency_symbol', $data ?? [], null);
        $this->setIfExists('default_tax_id', $data ?? [], null);
        $this->setIfExists('deleted_at', $data ?? [], null);
        $this->setIfExists('display_prices', $data ?? [], null);
        $this->setIfExists('email', $data ?? [], null);
        $this->setIfExists('id', $data ?? [], null);
        $this->setIfExists('name', $data ?? [], null);
        $this->setIfExists('physical_address_1', $data ?? [], null);
        $this->setIfExists('physical_address_2', $data ?? [], null);
        $this->setIfExists('physical_city', $data ?? [], null);
        $this->setIfExists('physical_country_id', $data ?? [], null);
        $this->setIfExists('physical_postcode', $data ?? [], null);
        $this->setIfExists('physical_state', $data ?? [], null);
        $this->setIfExists('physical_suburb', $data ?? [], null);
        $this->setIfExists('time_zone', $data ?? [], null);
        $this->setIfExists('version', $data ?? [], null);
    }

    /**
    * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
    * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
    * $this->openAPINullablesSetToNull array
    *
    * @param string $variableName
    * @param array  $fields
    * @param mixed  $defaultValue
    */
    private function setIfExists(string $variableName, array $fields, $defaultValue): void
    {
        if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
            $this->openAPINullablesSetToNull[] = $variableName;
        }

        $this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
    }

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

        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 attributes
     *
     * @return \Vend202601\Model\Attribute[]|null
     */
    public function getAttributes()
    {
        return $this->container['attributes'];
    }

    /**
     * Sets attributes
     *
     * @param \Vend202601\Model\Attribute[]|null $attributes The outlet attributes such as `low_stock_warning`, `order_reference`, `order_reference_prefix`, `return_reference`, `return_reference_prefix`.
     *
     * @return self
     */
    public function setAttributes($attributes)
    {
        if (is_null($attributes)) {
            throw new \InvalidArgumentException('non-nullable attributes cannot be null');
        }
        $this->container['attributes'] = $attributes;

        return $this;
    }

    /**
     * Gets currency
     *
     * @return string|null
     */
    public function getCurrency()
    {
        return $this->container['currency'];
    }

    /**
     * Sets currency
     *
     * @param string|null $currency Currency name.
     *
     * @return self
     */
    public function setCurrency($currency)
    {
        if (is_null($currency)) {
            throw new \InvalidArgumentException('non-nullable currency cannot be null');
        }
        $this->container['currency'] = $currency;

        return $this;
    }

    /**
     * Gets currency_symbol
     *
     * @return string|null
     */
    public function getCurrencySymbol()
    {
        return $this->container['currency_symbol'];
    }

    /**
     * Sets currency_symbol
     *
     * @param string|null $currency_symbol Currency symbol.
     *
     * @return self
     */
    public function setCurrencySymbol($currency_symbol)
    {
        if (is_null($currency_symbol)) {
            throw new \InvalidArgumentException('non-nullable currency_symbol cannot be null');
        }
        $this->container['currency_symbol'] = $currency_symbol;

        return $this;
    }

    /**
     * Gets default_tax_id
     *
     * @return string|null
     * @deprecated
     */
    public function getDefaultTaxId()
    {
        return $this->container['default_tax_id'];
    }

    /**
     * Sets default_tax_id
     *
     * @param string|null $default_tax_id Default tax id used for sales in this outlet. **deprecated**
     *
     * @return self
     * @deprecated
     */
    public function setDefaultTaxId($default_tax_id)
    {
        if (is_null($default_tax_id)) {
            throw new \InvalidArgumentException('non-nullable default_tax_id cannot be null');
        }
        $this->container['default_tax_id'] = $default_tax_id;

        return $this;
    }

    /**
     * Gets deleted_at
     *
     * @return string|null
     */
    public function getDeletedAt()
    {
        return $this->container['deleted_at'];
    }

    /**
     * Sets deleted_at
     *
     * @param string|null $deleted_at Deletion timestamp in UTC.
     *
     * @return self
     */
    public function setDeletedAt($deleted_at)
    {
        if (is_null($deleted_at)) {
            array_push($this->openAPINullablesSetToNull, 'deleted_at');
        } else {
            $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
            $index = array_search('deleted_at', $nullablesSetToNull);
            if ($index !== FALSE) {
                unset($nullablesSetToNull[$index]);
                $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
            }
        }
        $this->container['deleted_at'] = $deleted_at;

        return $this;
    }

    /**
     * Gets display_prices
     *
     * @return string|null
     */
    public function getDisplayPrices()
    {
        return $this->container['display_prices'];
    }

    /**
     * Sets display_prices
     *
     * @param string|null $display_prices Indicates whether prices in this outlet should be displayed as tax-inclusive.
     *
     * @return self
     */
    public function setDisplayPrices($display_prices)
    {
        if (is_null($display_prices)) {
            throw new \InvalidArgumentException('non-nullable display_prices cannot be null');
        }
        $this->container['display_prices'] = $display_prices;

        return $this;
    }

    /**
     * Gets email
     *
     * @return string|null
     */
    public function getEmail()
    {
        return $this->container['email'];
    }

    /**
     * Sets email
     *
     * @param string|null $email Specified email for the outlet.
     *
     * @return self
     */
    public function setEmail($email)
    {
        if (is_null($email)) {
            throw new \InvalidArgumentException('non-nullable email cannot be null');
        }
        $this->container['email'] = $email;

        return $this;
    }

    /**
     * Gets id
     *
     * @return string|null
     */
    public function getId()
    {
        return $this->container['id'];
    }

    /**
     * Sets id
     *
     * @param string|null $id Auto-generated object ID.
     *
     * @return self
     */
    public function setId($id)
    {
        if (is_null($id)) {
            throw new \InvalidArgumentException('non-nullable id cannot be null');
        }
        $this->container['id'] = $id;

        return $this;
    }

    /**
     * Gets name
     *
     * @return string|null
     */
    public function getName()
    {
        return $this->container['name'];
    }

    /**
     * Sets name
     *
     * @param string|null $name The outlet name.
     *
     * @return self
     */
    public function setName($name)
    {
        if (is_null($name)) {
            throw new \InvalidArgumentException('non-nullable name cannot be null');
        }
        $this->container['name'] = $name;

        return $this;
    }

    /**
     * Gets physical_address_1
     *
     * @return string|null
     */
    public function getPhysicalAddress1()
    {
        return $this->container['physical_address_1'];
    }

    /**
     * Sets physical_address_1
     *
     * @param string|null $physical_address_1 Physical address, line 1.
     *
     * @return self
     */
    public function setPhysicalAddress1($physical_address_1)
    {
        if (is_null($physical_address_1)) {
            throw new \InvalidArgumentException('non-nullable physical_address_1 cannot be null');
        }
        $this->container['physical_address_1'] = $physical_address_1;

        return $this;
    }

    /**
     * Gets physical_address_2
     *
     * @return string|null
     */
    public function getPhysicalAddress2()
    {
        return $this->container['physical_address_2'];
    }

    /**
     * Sets physical_address_2
     *
     * @param string|null $physical_address_2 Physical address, line 2.
     *
     * @return self
     */
    public function setPhysicalAddress2($physical_address_2)
    {
        if (is_null($physical_address_2)) {
            throw new \InvalidArgumentException('non-nullable physical_address_2 cannot be null');
        }
        $this->container['physical_address_2'] = $physical_address_2;

        return $this;
    }

    /**
     * Gets physical_city
     *
     * @return string|null
     */
    public function getPhysicalCity()
    {
        return $this->container['physical_city'];
    }

    /**
     * Sets physical_city
     *
     * @param string|null $physical_city Physical address, city.
     *
     * @return self
     */
    public function setPhysicalCity($physical_city)
    {
        if (is_null($physical_city)) {
            throw new \InvalidArgumentException('non-nullable physical_city cannot be null');
        }
        $this->container['physical_city'] = $physical_city;

        return $this;
    }

    /**
     * Gets physical_country_id
     *
     * @return string|null
     */
    public function getPhysicalCountryId()
    {
        return $this->container['physical_country_id'];
    }

    /**
     * Sets physical_country_id
     *
     * @param string|null $physical_country_id Physical address, country code.
     *
     * @return self
     */
    public function setPhysicalCountryId($physical_country_id)
    {
        if (is_null($physical_country_id)) {
            throw new \InvalidArgumentException('non-nullable physical_country_id cannot be null');
        }
        $this->container['physical_country_id'] = $physical_country_id;

        return $this;
    }

    /**
     * Gets physical_postcode
     *
     * @return string|null
     */
    public function getPhysicalPostcode()
    {
        return $this->container['physical_postcode'];
    }

    /**
     * Sets physical_postcode
     *
     * @param string|null $physical_postcode Physical address, post code.
     *
     * @return self
     */
    public function setPhysicalPostcode($physical_postcode)
    {
        if (is_null($physical_postcode)) {
            throw new \InvalidArgumentException('non-nullable physical_postcode cannot be null');
        }
        $this->container['physical_postcode'] = $physical_postcode;

        return $this;
    }

    /**
     * Gets physical_state
     *
     * @return string|null
     */
    public function getPhysicalState()
    {
        return $this->container['physical_state'];
    }

    /**
     * Sets physical_state
     *
     * @param string|null $physical_state Physical address, state.
     *
     * @return self
     */
    public function setPhysicalState($physical_state)
    {
        if (is_null($physical_state)) {
            throw new \InvalidArgumentException('non-nullable physical_state cannot be null');
        }
        $this->container['physical_state'] = $physical_state;

        return $this;
    }

    /**
     * Gets physical_suburb
     *
     * @return string|null
     */
    public function getPhysicalSuburb()
    {
        return $this->container['physical_suburb'];
    }

    /**
     * Sets physical_suburb
     *
     * @param string|null $physical_suburb Physical address, suburb.
     *
     * @return self
     */
    public function setPhysicalSuburb($physical_suburb)
    {
        if (is_null($physical_suburb)) {
            throw new \InvalidArgumentException('non-nullable physical_suburb cannot be null');
        }
        $this->container['physical_suburb'] = $physical_suburb;

        return $this;
    }

    /**
     * Gets time_zone
     *
     * @return string|null
     */
    public function getTimeZone()
    {
        return $this->container['time_zone'];
    }

    /**
     * Sets time_zone
     *
     * @param string|null $time_zone Outlet timezone. **read only**
     *
     * @return self
     */
    public function setTimeZone($time_zone)
    {
        if (is_null($time_zone)) {
            throw new \InvalidArgumentException('non-nullable time_zone cannot be null');
        }
        $this->container['time_zone'] = $time_zone;

        return $this;
    }

    /**
     * Gets version
     *
     * @return int|null
     */
    public function getVersion()
    {
        return $this->container['version'];
    }

    /**
     * Sets version
     *
     * @param int|null $version Auto-incrementing object version number.
     *
     * @return self
     */
    public function setVersion($version)
    {
        if (is_null($version)) {
            throw new \InvalidArgumentException('non-nullable version cannot be null');
        }
        $this->container['version'] = $version;

        return $this;
    }
    /**
     * Returns true if offset exists. False otherwise.
     *
     * @param integer|string $offset Offset
     *
     * @return boolean
     */
    public function offsetExists(mixed $offset): bool
    {
        return isset($this->container[$offset]);
    }

    /**
     * Gets offset.
     *
     * @param integer|string $offset Offset
     *
     * @return mixed|null
     */
    #[\ReturnTypeWillChange]
    public function offsetGet(mixed $offset)
    {
        return $this->container[$offset] ?? null;
    }

    /**
     * Sets value based on offset.
     *
     * @param int|null $offset Offset
     * @param mixed    $value  Value to be set
     *
     * @return void
     */
    public function offsetSet($offset, $value): void
    {
        if (is_null($offset)) {
            $this->container[] = $value;
        } else {
            $this->container[$offset] = $value;
        }
    }

    /**
     * Unsets offset.
     *
     * @param integer|string $offset Offset
     *
     * @return void
     */
    public function offsetUnset(mixed $offset): void
    {
        unset($this->container[$offset]);
    }

    /**
     * Serializes the object to a value that can be serialized natively by json_encode().
     * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
     *
     * @return mixed Returns data which can be serialized by json_encode(), which is a value
     * of any type other than a resource.
     */
    #[\ReturnTypeWillChange]
    public function jsonSerialize()
    {
       return ObjectSerializer::sanitizeForSerialization($this);
    }

    /**
     * Gets the string presentation of the object
     *
     * @return string
     */
    public function __toString()
    {
        return json_encode(
            ObjectSerializer::sanitizeForSerialization($this),
            JSON_PRETTY_PRINT
        );
    }

    /**
     * Gets a header-safe presentation of the object
     *
     * @return string
     */
    public function toHeaderValue()
    {
        return json_encode(ObjectSerializer::sanitizeForSerialization($this));
    }
}


