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

/**
 * FinFeedAPI Stock REST API
 *
 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
 *
 * The version of the OpenAPI document: v1
 * Contact: support@apibricks.io
 * Generated by: https://openapi-generator.tech
 * Generator version: 7.14.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 OpenAPI\Client\Model;

use \ArrayAccess;
use \OpenAPI\Client\ObjectSerializer;

/**
 * AdminRetailLiquidityIndicatorModel Class Doc Comment
 *
 * @category Class
 * @description Represents the response DTO for retail liquidity indicator information
 * @package  OpenAPI\Client
 * @author   OpenAPI Generator team
 * @link     https://openapi-generator.tech
 * @implements \ArrayAccess<string, mixed>
 */
class AdminRetailLiquidityIndicatorModel implements ModelInterface, ArrayAccess, \JsonSerializable
{
    public const DISCRIMINATOR = null;

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

    /**
      * Array of property to type mappings. Used for (de)serialization
      *
      * @var string[]
      */
    protected static $openAPITypes = [
        'symbol' => 'string',
        'timestamp_nanos' => 'int',
        'timestamp' => '\DateTime',
        'retail_liquidity_indicator' => 'int',
        'retail_liquidity_indicator_code' => 'string',
        'retail_liquidity_indicator_text' => 'string',
        'is_retail_indicator_not_applicable' => 'bool',
        'is_retail_indicator_buy_interest' => 'bool',
        'is_retail_indicator_sell_interest' => 'bool',
        'is_retail_indicator_buy_and_sell_interest' => 'bool'
    ];

    /**
      * 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 = [
        'symbol' => null,
        'timestamp_nanos' => 'int64',
        'timestamp' => 'date-time',
        'retail_liquidity_indicator' => 'int32',
        'retail_liquidity_indicator_code' => null,
        'retail_liquidity_indicator_text' => null,
        'is_retail_indicator_not_applicable' => null,
        'is_retail_indicator_buy_interest' => null,
        'is_retail_indicator_sell_interest' => null,
        'is_retail_indicator_buy_and_sell_interest' => null
    ];

    /**
      * Array of nullable properties. Used for (de)serialization
      *
      * @var boolean[]
      */
    protected static array $openAPINullables = [
        'symbol' => true,
        'timestamp_nanos' => false,
        'timestamp' => false,
        'retail_liquidity_indicator' => false,
        'retail_liquidity_indicator_code' => true,
        'retail_liquidity_indicator_text' => true,
        'is_retail_indicator_not_applicable' => false,
        'is_retail_indicator_buy_interest' => false,
        'is_retail_indicator_sell_interest' => false,
        'is_retail_indicator_buy_and_sell_interest' => 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 = [
        'symbol' => 'symbol',
        'timestamp_nanos' => 'timestamp_nanos',
        'timestamp' => 'timestamp',
        'retail_liquidity_indicator' => 'retail_liquidity_indicator',
        'retail_liquidity_indicator_code' => 'retail_liquidity_indicator_code',
        'retail_liquidity_indicator_text' => 'retail_liquidity_indicator_text',
        'is_retail_indicator_not_applicable' => 'is_retail_indicator_not_applicable',
        'is_retail_indicator_buy_interest' => 'is_retail_indicator_buy_interest',
        'is_retail_indicator_sell_interest' => 'is_retail_indicator_sell_interest',
        'is_retail_indicator_buy_and_sell_interest' => 'is_retail_indicator_buy_and_sell_interest'
    ];

    /**
     * Array of attributes to setter functions (for deserialization of responses)
     *
     * @var string[]
     */
    protected static $setters = [
        'symbol' => 'setSymbol',
        'timestamp_nanos' => 'setTimestampNanos',
        'timestamp' => 'setTimestamp',
        'retail_liquidity_indicator' => 'setRetailLiquidityIndicator',
        'retail_liquidity_indicator_code' => 'setRetailLiquidityIndicatorCode',
        'retail_liquidity_indicator_text' => 'setRetailLiquidityIndicatorText',
        'is_retail_indicator_not_applicable' => 'setIsRetailIndicatorNotApplicable',
        'is_retail_indicator_buy_interest' => 'setIsRetailIndicatorBuyInterest',
        'is_retail_indicator_sell_interest' => 'setIsRetailIndicatorSellInterest',
        'is_retail_indicator_buy_and_sell_interest' => 'setIsRetailIndicatorBuyAndSellInterest'
    ];

    /**
     * Array of attributes to getter functions (for serialization of requests)
     *
     * @var string[]
     */
    protected static $getters = [
        'symbol' => 'getSymbol',
        'timestamp_nanos' => 'getTimestampNanos',
        'timestamp' => 'getTimestamp',
        'retail_liquidity_indicator' => 'getRetailLiquidityIndicator',
        'retail_liquidity_indicator_code' => 'getRetailLiquidityIndicatorCode',
        'retail_liquidity_indicator_text' => 'getRetailLiquidityIndicatorText',
        'is_retail_indicator_not_applicable' => 'getIsRetailIndicatorNotApplicable',
        'is_retail_indicator_buy_interest' => 'getIsRetailIndicatorBuyInterest',
        'is_retail_indicator_sell_interest' => 'getIsRetailIndicatorSellInterest',
        'is_retail_indicator_buy_and_sell_interest' => 'getIsRetailIndicatorBuyAndSellInterest'
    ];

    /**
     * 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('symbol', $data ?? [], null);
        $this->setIfExists('timestamp_nanos', $data ?? [], null);
        $this->setIfExists('timestamp', $data ?? [], null);
        $this->setIfExists('retail_liquidity_indicator', $data ?? [], null);
        $this->setIfExists('retail_liquidity_indicator_code', $data ?? [], null);
        $this->setIfExists('retail_liquidity_indicator_text', $data ?? [], null);
        $this->setIfExists('is_retail_indicator_not_applicable', $data ?? [], null);
        $this->setIfExists('is_retail_indicator_buy_interest', $data ?? [], null);
        $this->setIfExists('is_retail_indicator_sell_interest', $data ?? [], null);
        $this->setIfExists('is_retail_indicator_buy_and_sell_interest', $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 symbol
     *
     * @return string|null
     */
    public function getSymbol()
    {
        return $this->container['symbol'];
    }

    /**
     * Sets symbol
     *
     * @param string|null $symbol The stock symbol
     *
     * @return self
     */
    public function setSymbol($symbol)
    {
        if (is_null($symbol)) {
            array_push($this->openAPINullablesSetToNull, 'symbol');
        } else {
            $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
            $index = array_search('symbol', $nullablesSetToNull);
            if ($index !== FALSE) {
                unset($nullablesSetToNull[$index]);
                $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
            }
        }
        $this->container['symbol'] = $symbol;

        return $this;
    }

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

    /**
     * Sets timestamp_nanos
     *
     * @param int|null $timestamp_nanos Original timestamp in nanoseconds since epoch
     *
     * @return self
     */
    public function setTimestampNanos($timestamp_nanos)
    {
        if (is_null($timestamp_nanos)) {
            throw new \InvalidArgumentException('non-nullable timestamp_nanos cannot be null');
        }
        $this->container['timestamp_nanos'] = $timestamp_nanos;

        return $this;
    }

    /**
     * Gets timestamp
     *
     * @return \DateTime|null
     */
    public function getTimestamp()
    {
        return $this->container['timestamp'];
    }

    /**
     * Sets timestamp
     *
     * @param \DateTime|null $timestamp Time when the retail liquidity indicator was recorded as DateTime
     *
     * @return self
     */
    public function setTimestamp($timestamp)
    {
        if (is_null($timestamp)) {
            throw new \InvalidArgumentException('non-nullable timestamp cannot be null');
        }
        $this->container['timestamp'] = $timestamp;

        return $this;
    }

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

    /**
     * Sets retail_liquidity_indicator
     *
     * @param int|null $retail_liquidity_indicator Retail liquidity indicator as byte value
     *
     * @return self
     */
    public function setRetailLiquidityIndicator($retail_liquidity_indicator)
    {
        if (is_null($retail_liquidity_indicator)) {
            throw new \InvalidArgumentException('non-nullable retail_liquidity_indicator cannot be null');
        }
        $this->container['retail_liquidity_indicator'] = $retail_liquidity_indicator;

        return $this;
    }

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

    /**
     * Sets retail_liquidity_indicator_code
     *
     * @param string|null $retail_liquidity_indicator_code Retail liquidity indicator as character string
     *
     * @return self
     */
    public function setRetailLiquidityIndicatorCode($retail_liquidity_indicator_code)
    {
        if (is_null($retail_liquidity_indicator_code)) {
            array_push($this->openAPINullablesSetToNull, 'retail_liquidity_indicator_code');
        } else {
            $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
            $index = array_search('retail_liquidity_indicator_code', $nullablesSetToNull);
            if ($index !== FALSE) {
                unset($nullablesSetToNull[$index]);
                $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
            }
        }
        $this->container['retail_liquidity_indicator_code'] = $retail_liquidity_indicator_code;

        return $this;
    }

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

    /**
     * Sets retail_liquidity_indicator_text
     *
     * @param string|null $retail_liquidity_indicator_text Human-readable description of the retail liquidity indicator
     *
     * @return self
     */
    public function setRetailLiquidityIndicatorText($retail_liquidity_indicator_text)
    {
        if (is_null($retail_liquidity_indicator_text)) {
            array_push($this->openAPINullablesSetToNull, 'retail_liquidity_indicator_text');
        } else {
            $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
            $index = array_search('retail_liquidity_indicator_text', $nullablesSetToNull);
            if ($index !== FALSE) {
                unset($nullablesSetToNull[$index]);
                $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
            }
        }
        $this->container['retail_liquidity_indicator_text'] = $retail_liquidity_indicator_text;

        return $this;
    }

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

    /**
     * Sets is_retail_indicator_not_applicable
     *
     * @param bool|null $is_retail_indicator_not_applicable Indicates if the indicator is 'Not Applicable' (' '/0x20).
     *
     * @return self
     */
    public function setIsRetailIndicatorNotApplicable($is_retail_indicator_not_applicable)
    {
        if (is_null($is_retail_indicator_not_applicable)) {
            throw new \InvalidArgumentException('non-nullable is_retail_indicator_not_applicable cannot be null');
        }
        $this->container['is_retail_indicator_not_applicable'] = $is_retail_indicator_not_applicable;

        return $this;
    }

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

    /**
     * Sets is_retail_indicator_buy_interest
     *
     * @param bool|null $is_retail_indicator_buy_interest Indicates if there is 'Buy interest for Retail' ('A'/0x41).
     *
     * @return self
     */
    public function setIsRetailIndicatorBuyInterest($is_retail_indicator_buy_interest)
    {
        if (is_null($is_retail_indicator_buy_interest)) {
            throw new \InvalidArgumentException('non-nullable is_retail_indicator_buy_interest cannot be null');
        }
        $this->container['is_retail_indicator_buy_interest'] = $is_retail_indicator_buy_interest;

        return $this;
    }

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

    /**
     * Sets is_retail_indicator_sell_interest
     *
     * @param bool|null $is_retail_indicator_sell_interest Indicates if there is 'Sell interest for Retail' ('B'/0x42).
     *
     * @return self
     */
    public function setIsRetailIndicatorSellInterest($is_retail_indicator_sell_interest)
    {
        if (is_null($is_retail_indicator_sell_interest)) {
            throw new \InvalidArgumentException('non-nullable is_retail_indicator_sell_interest cannot be null');
        }
        $this->container['is_retail_indicator_sell_interest'] = $is_retail_indicator_sell_interest;

        return $this;
    }

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

    /**
     * Sets is_retail_indicator_buy_and_sell_interest
     *
     * @param bool|null $is_retail_indicator_buy_and_sell_interest Indicates if there is 'Buy and sell interest for Retail' ('C'/0x43).
     *
     * @return self
     */
    public function setIsRetailIndicatorBuyAndSellInterest($is_retail_indicator_buy_and_sell_interest)
    {
        if (is_null($is_retail_indicator_buy_and_sell_interest)) {
            throw new \InvalidArgumentException('non-nullable is_retail_indicator_buy_and_sell_interest cannot be null');
        }
        $this->container['is_retail_indicator_buy_and_sell_interest'] = $is_retail_indicator_buy_and_sell_interest;

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

    /**
     * Gets offset.
     *
     * @param integer $offset Offset
     *
     * @return mixed|null
     */
    #[\ReturnTypeWillChange]
    public function offsetGet($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 $offset Offset
     *
     * @return void
     */
    public function offsetUnset($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));
    }
}


