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

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

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

    /**
      * Array of property to type mappings. Used for (de)serialization
      *
      * @var string[]
      */
    protected static $openAPITypes = [
        'account_status' => 'string',
        'account_type' => 'string',
        'activated_at' => 'string',
        'country' => 'string',
        'created_at' => 'string',
        'culture' => 'string',
        'currency' => '\Vend202601\Model\RetailerCurrency',
        'discount_product_id' => 'string',
        'domain_prefix' => 'string',
        'gift_cards' => '\Vend202601\Model\RetailerGiftCards',
        'id' => 'string',
        'loyalty' => '\Vend202601\Model\RetailerLoyalty',
        'name' => 'string',
        'no_tax_group_id' => 'string',
        'sku_sequence' => '\Vend202601\Model\RetailerSkuSequence',
        'store_credit' => 'bool',
        'store_url' => 'string',
        'tax_exclusive' => 'bool',
        'timezone' => 'string',
        'version' => 'string'
    ];

    /**
      * 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 = [
        'account_status' => null,
        'account_type' => null,
        'activated_at' => null,
        'country' => null,
        'created_at' => null,
        'culture' => null,
        'currency' => null,
        'discount_product_id' => 'uuid',
        'domain_prefix' => null,
        'gift_cards' => null,
        'id' => 'uuid',
        'loyalty' => null,
        'name' => null,
        'no_tax_group_id' => 'uuid',
        'sku_sequence' => null,
        'store_credit' => null,
        'store_url' => null,
        'tax_exclusive' => null,
        'timezone' => null,
        'version' => null
    ];

    /**
      * Array of nullable properties. Used for (de)serialization
      *
      * @var boolean[]
      */
    protected static array $openAPINullables = [
        'account_status' => false,
        'account_type' => false,
        'activated_at' => false,
        'country' => false,
        'created_at' => false,
        'culture' => false,
        'currency' => false,
        'discount_product_id' => false,
        'domain_prefix' => false,
        'gift_cards' => false,
        'id' => false,
        'loyalty' => false,
        'name' => false,
        'no_tax_group_id' => false,
        'sku_sequence' => false,
        'store_credit' => false,
        'store_url' => false,
        'tax_exclusive' => false,
        'timezone' => 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 = [
        'account_status' => 'account_status',
        'account_type' => 'account_type',
        'activated_at' => 'activated_at',
        'country' => 'country',
        'created_at' => 'created_at',
        'culture' => 'culture',
        'currency' => 'currency',
        'discount_product_id' => 'discount_product_id',
        'domain_prefix' => 'domain_prefix',
        'gift_cards' => 'gift_cards',
        'id' => 'id',
        'loyalty' => 'loyalty',
        'name' => 'name',
        'no_tax_group_id' => 'no_tax_group_id',
        'sku_sequence' => 'sku_sequence',
        'store_credit' => 'store_credit',
        'store_url' => 'store_url',
        'tax_exclusive' => 'tax_exclusive',
        'timezone' => 'timezone',
        'version' => 'version'
    ];

    /**
     * Array of attributes to setter functions (for deserialization of responses)
     *
     * @var string[]
     */
    protected static $setters = [
        'account_status' => 'setAccountStatus',
        'account_type' => 'setAccountType',
        'activated_at' => 'setActivatedAt',
        'country' => 'setCountry',
        'created_at' => 'setCreatedAt',
        'culture' => 'setCulture',
        'currency' => 'setCurrency',
        'discount_product_id' => 'setDiscountProductId',
        'domain_prefix' => 'setDomainPrefix',
        'gift_cards' => 'setGiftCards',
        'id' => 'setId',
        'loyalty' => 'setLoyalty',
        'name' => 'setName',
        'no_tax_group_id' => 'setNoTaxGroupId',
        'sku_sequence' => 'setSkuSequence',
        'store_credit' => 'setStoreCredit',
        'store_url' => 'setStoreUrl',
        'tax_exclusive' => 'setTaxExclusive',
        'timezone' => 'setTimezone',
        'version' => 'setVersion'
    ];

    /**
     * Array of attributes to getter functions (for serialization of requests)
     *
     * @var string[]
     */
    protected static $getters = [
        'account_status' => 'getAccountStatus',
        'account_type' => 'getAccountType',
        'activated_at' => 'getActivatedAt',
        'country' => 'getCountry',
        'created_at' => 'getCreatedAt',
        'culture' => 'getCulture',
        'currency' => 'getCurrency',
        'discount_product_id' => 'getDiscountProductId',
        'domain_prefix' => 'getDomainPrefix',
        'gift_cards' => 'getGiftCards',
        'id' => 'getId',
        'loyalty' => 'getLoyalty',
        'name' => 'getName',
        'no_tax_group_id' => 'getNoTaxGroupId',
        'sku_sequence' => 'getSkuSequence',
        'store_credit' => 'getStoreCredit',
        'store_url' => 'getStoreUrl',
        'tax_exclusive' => 'getTaxExclusive',
        'timezone' => '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('account_status', $data ?? [], null);
        $this->setIfExists('account_type', $data ?? [], null);
        $this->setIfExists('activated_at', $data ?? [], null);
        $this->setIfExists('country', $data ?? [], null);
        $this->setIfExists('created_at', $data ?? [], null);
        $this->setIfExists('culture', $data ?? [], null);
        $this->setIfExists('currency', $data ?? [], null);
        $this->setIfExists('discount_product_id', $data ?? [], null);
        $this->setIfExists('domain_prefix', $data ?? [], null);
        $this->setIfExists('gift_cards', $data ?? [], null);
        $this->setIfExists('id', $data ?? [], null);
        $this->setIfExists('loyalty', $data ?? [], null);
        $this->setIfExists('name', $data ?? [], null);
        $this->setIfExists('no_tax_group_id', $data ?? [], null);
        $this->setIfExists('sku_sequence', $data ?? [], null);
        $this->setIfExists('store_credit', $data ?? [], null);
        $this->setIfExists('store_url', $data ?? [], null);
        $this->setIfExists('tax_exclusive', $data ?? [], null);
        $this->setIfExists('timezone', $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 account_status
     *
     * @return string|null
     */
    public function getAccountStatus()
    {
        return $this->container['account_status'];
    }

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

        return $this;
    }

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

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

        return $this;
    }

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

    /**
     * Sets activated_at
     *
     * @param string|null $activated_at Activation timestamp, e.g. '2019-08-15T23:05:28Z'. This field can be null, e.g. for 'demo' retailers.
     *
     * @return self
     */
    public function setActivatedAt($activated_at)
    {
        if (is_null($activated_at)) {
            throw new \InvalidArgumentException('non-nullable activated_at cannot be null');
        }
        $this->container['activated_at'] = $activated_at;

        return $this;
    }

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

    /**
     * Sets country
     *
     * @param string|null $country 2-letter country code for this Retailer.
     *
     * @return self
     */
    public function setCountry($country)
    {
        if (is_null($country)) {
            throw new \InvalidArgumentException('non-nullable country cannot be null');
        }
        $this->container['country'] = $country;

        return $this;
    }

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

    /**
     * Sets created_at
     *
     * @param string|null $created_at Creation timestamp, e.g. '2019-08-15T23:05:28Z'
     *
     * @return self
     */
    public function setCreatedAt($created_at)
    {
        if (is_null($created_at)) {
            throw new \InvalidArgumentException('non-nullable created_at cannot be null');
        }
        $this->container['created_at'] = $created_at;

        return $this;
    }

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

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

        return $this;
    }

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

    /**
     * Sets currency
     *
     * @param \Vend202601\Model\RetailerCurrency|null $currency currency
     *
     * @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 discount_product_id
     *
     * @return string|null
     */
    public function getDiscountProductId()
    {
        return $this->container['discount_product_id'];
    }

    /**
     * Sets discount_product_id
     *
     * @param string|null $discount_product_id A reference to the default discount product used for sale-level discounts.
     *
     * @return self
     */
    public function setDiscountProductId($discount_product_id)
    {
        if (is_null($discount_product_id)) {
            throw new \InvalidArgumentException('non-nullable discount_product_id cannot be null');
        }
        $this->container['discount_product_id'] = $discount_product_id;

        return $this;
    }

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

    /**
     * Sets domain_prefix
     *
     * @param string|null $domain_prefix The subdomain of vendhq.com for this retailer.
     *
     * @return self
     */
    public function setDomainPrefix($domain_prefix)
    {
        if (is_null($domain_prefix)) {
            throw new \InvalidArgumentException('non-nullable domain_prefix cannot be null');
        }
        $this->container['domain_prefix'] = $domain_prefix;

        return $this;
    }

    /**
     * Gets gift_cards
     *
     * @return \Vend202601\Model\RetailerGiftCards|null
     */
    public function getGiftCards()
    {
        return $this->container['gift_cards'];
    }

    /**
     * Sets gift_cards
     *
     * @param \Vend202601\Model\RetailerGiftCards|null $gift_cards gift_cards
     *
     * @return self
     */
    public function setGiftCards($gift_cards)
    {
        if (is_null($gift_cards)) {
            throw new \InvalidArgumentException('non-nullable gift_cards cannot be null');
        }
        $this->container['gift_cards'] = $gift_cards;

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

    /**
     * Sets loyalty
     *
     * @param \Vend202601\Model\RetailerLoyalty|null $loyalty loyalty
     *
     * @return self
     */
    public function setLoyalty($loyalty)
    {
        if (is_null($loyalty)) {
            throw new \InvalidArgumentException('non-nullable loyalty cannot be null');
        }
        $this->container['loyalty'] = $loyalty;

        return $this;
    }

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

    /**
     * Sets name
     *
     * @param string|null $name Unique name for this Retailer.
     *
     * @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 no_tax_group_id
     *
     * @return string|null
     */
    public function getNoTaxGroupId()
    {
        return $this->container['no_tax_group_id'];
    }

    /**
     * Sets no_tax_group_id
     *
     * @param string|null $no_tax_group_id A reference to the default 0% rate tax used for tax-free line items.
     *
     * @return self
     */
    public function setNoTaxGroupId($no_tax_group_id)
    {
        if (is_null($no_tax_group_id)) {
            throw new \InvalidArgumentException('non-nullable no_tax_group_id cannot be null');
        }
        $this->container['no_tax_group_id'] = $no_tax_group_id;

        return $this;
    }

    /**
     * Gets sku_sequence
     *
     * @return \Vend202601\Model\RetailerSkuSequence|null
     */
    public function getSkuSequence()
    {
        return $this->container['sku_sequence'];
    }

    /**
     * Sets sku_sequence
     *
     * @param \Vend202601\Model\RetailerSkuSequence|null $sku_sequence sku_sequence
     *
     * @return self
     */
    public function setSkuSequence($sku_sequence)
    {
        if (is_null($sku_sequence)) {
            throw new \InvalidArgumentException('non-nullable sku_sequence cannot be null');
        }
        $this->container['sku_sequence'] = $sku_sequence;

        return $this;
    }

    /**
     * Gets store_credit
     *
     * @return bool|null
     */
    public function getStoreCredit()
    {
        return $this->container['store_credit'];
    }

    /**
     * Sets store_credit
     *
     * @param bool|null $store_credit Whether the Retailer has enabled Store Credit.
     *
     * @return self
     */
    public function setStoreCredit($store_credit)
    {
        if (is_null($store_credit)) {
            throw new \InvalidArgumentException('non-nullable store_credit cannot be null');
        }
        $this->container['store_credit'] = $store_credit;

        return $this;
    }

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

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

        return $this;
    }

    /**
     * Gets tax_exclusive
     *
     * @return bool|null
     */
    public function getTaxExclusive()
    {
        return $this->container['tax_exclusive'];
    }

    /**
     * Sets tax_exclusive
     *
     * @param bool|null $tax_exclusive Whether Prices should be interpreted as Tax-Exclusive.
     *
     * @return self
     */
    public function setTaxExclusive($tax_exclusive)
    {
        if (is_null($tax_exclusive)) {
            throw new \InvalidArgumentException('non-nullable tax_exclusive cannot be null');
        }
        $this->container['tax_exclusive'] = $tax_exclusive;

        return $this;
    }

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

    /**
     * Sets timezone
     *
     * @param string|null $timezone Default Timezone for retailer - e.g. Pacific/Auckland. NOTE: timezones can vary between Outlets.
     *
     * @return self
     */
    public function setTimezone($timezone)
    {
        if (is_null($timezone)) {
            throw new \InvalidArgumentException('non-nullable timezone cannot be null');
        }
        $this->container['timezone'] = $timezone;

        return $this;
    }

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

    /**
     * Sets version
     *
     * @param string|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));
    }
}


