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

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

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

    /**
      * Array of property to type mappings. Used for (de)serialization
      *
      * @var string[]
      */
    protected static $openAPITypes = [
        'symbol' => 'string',
        'timestamp_nanos' => 'int',
        'timestamp' => '\DateTime',
        'flags' => 'int',
        'round_lot_size' => 'int',
        'adjusted_poc_price' => 'float',
        'luld_tier' => 'int',
        'luld_tier_code' => 'string',
        'luld_tier_text' => 'string',
        'is_luld_tier_not_applicable' => 'bool',
        'is_luld_tier1' => 'bool',
        'is_luld_tier2' => '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',
        'flags' => 'int32',
        'round_lot_size' => 'int32',
        'adjusted_poc_price' => 'double',
        'luld_tier' => 'int32',
        'luld_tier_code' => null,
        'luld_tier_text' => null,
        'is_luld_tier_not_applicable' => null,
        'is_luld_tier1' => null,
        'is_luld_tier2' => null
    ];

    /**
      * Array of nullable properties. Used for (de)serialization
      *
      * @var boolean[]
      */
    protected static array $openAPINullables = [
        'symbol' => true,
        'timestamp_nanos' => false,
        'timestamp' => false,
        'flags' => false,
        'round_lot_size' => false,
        'adjusted_poc_price' => false,
        'luld_tier' => false,
        'luld_tier_code' => true,
        'luld_tier_text' => true,
        'is_luld_tier_not_applicable' => false,
        'is_luld_tier1' => false,
        'is_luld_tier2' => 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',
        'flags' => 'flags',
        'round_lot_size' => 'round_lot_size',
        'adjusted_poc_price' => 'adjusted_poc_price',
        'luld_tier' => 'luld_tier',
        'luld_tier_code' => 'luld_tier_code',
        'luld_tier_text' => 'luld_tier_text',
        'is_luld_tier_not_applicable' => 'is_luld_tier_not_applicable',
        'is_luld_tier1' => 'is_luld_tier1',
        'is_luld_tier2' => 'is_luld_tier2'
    ];

    /**
     * Array of attributes to setter functions (for deserialization of responses)
     *
     * @var string[]
     */
    protected static $setters = [
        'symbol' => 'setSymbol',
        'timestamp_nanos' => 'setTimestampNanos',
        'timestamp' => 'setTimestamp',
        'flags' => 'setFlags',
        'round_lot_size' => 'setRoundLotSize',
        'adjusted_poc_price' => 'setAdjustedPocPrice',
        'luld_tier' => 'setLuldTier',
        'luld_tier_code' => 'setLuldTierCode',
        'luld_tier_text' => 'setLuldTierText',
        'is_luld_tier_not_applicable' => 'setIsLuldTierNotApplicable',
        'is_luld_tier1' => 'setIsLuldTier1',
        'is_luld_tier2' => 'setIsLuldTier2'
    ];

    /**
     * Array of attributes to getter functions (for serialization of requests)
     *
     * @var string[]
     */
    protected static $getters = [
        'symbol' => 'getSymbol',
        'timestamp_nanos' => 'getTimestampNanos',
        'timestamp' => 'getTimestamp',
        'flags' => 'getFlags',
        'round_lot_size' => 'getRoundLotSize',
        'adjusted_poc_price' => 'getAdjustedPocPrice',
        'luld_tier' => 'getLuldTier',
        'luld_tier_code' => 'getLuldTierCode',
        'luld_tier_text' => 'getLuldTierText',
        'is_luld_tier_not_applicable' => 'getIsLuldTierNotApplicable',
        'is_luld_tier1' => 'getIsLuldTier1',
        'is_luld_tier2' => 'getIsLuldTier2'
    ];

    /**
     * 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('flags', $data ?? [], null);
        $this->setIfExists('round_lot_size', $data ?? [], null);
        $this->setIfExists('adjusted_poc_price', $data ?? [], null);
        $this->setIfExists('luld_tier', $data ?? [], null);
        $this->setIfExists('luld_tier_code', $data ?? [], null);
        $this->setIfExists('luld_tier_text', $data ?? [], null);
        $this->setIfExists('is_luld_tier_not_applicable', $data ?? [], null);
        $this->setIfExists('is_luld_tier1', $data ?? [], null);
        $this->setIfExists('is_luld_tier2', $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 security directory information 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 flags
     *
     * @return int|null
     */
    public function getFlags()
    {
        return $this->container['flags'];
    }

    /**
     * Sets flags
     *
     * @param int|null $flags Flags for the security
     *
     * @return self
     */
    public function setFlags($flags)
    {
        if (is_null($flags)) {
            throw new \InvalidArgumentException('non-nullable flags cannot be null');
        }
        $this->container['flags'] = $flags;

        return $this;
    }

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

    /**
     * Sets round_lot_size
     *
     * @param int|null $round_lot_size Number of shares that represent a round lot
     *
     * @return self
     */
    public function setRoundLotSize($round_lot_size)
    {
        if (is_null($round_lot_size)) {
            throw new \InvalidArgumentException('non-nullable round_lot_size cannot be null');
        }
        $this->container['round_lot_size'] = $round_lot_size;

        return $this;
    }

    /**
     * Gets adjusted_poc_price
     *
     * @return float|null
     */
    public function getAdjustedPocPrice()
    {
        return $this->container['adjusted_poc_price'];
    }

    /**
     * Sets adjusted_poc_price
     *
     * @param float|null $adjusted_poc_price Adjusted previous official closing price as decimal
     *
     * @return self
     */
    public function setAdjustedPocPrice($adjusted_poc_price)
    {
        if (is_null($adjusted_poc_price)) {
            throw new \InvalidArgumentException('non-nullable adjusted_poc_price cannot be null');
        }
        $this->container['adjusted_poc_price'] = $adjusted_poc_price;

        return $this;
    }

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

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

        return $this;
    }

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

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

        return $this;
    }

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

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

        return $this;
    }

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

    /**
     * Sets is_luld_tier_not_applicable
     *
     * @param bool|null $is_luld_tier_not_applicable Indicates if LULD Tier is 'Not applicable' (0x0).
     *
     * @return self
     */
    public function setIsLuldTierNotApplicable($is_luld_tier_not_applicable)
    {
        if (is_null($is_luld_tier_not_applicable)) {
            throw new \InvalidArgumentException('non-nullable is_luld_tier_not_applicable cannot be null');
        }
        $this->container['is_luld_tier_not_applicable'] = $is_luld_tier_not_applicable;

        return $this;
    }

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

    /**
     * Sets is_luld_tier1
     *
     * @param bool|null $is_luld_tier1 Indicates if LULD Tier is 'Tier 1 NMS Stock' (0x1).
     *
     * @return self
     */
    public function setIsLuldTier1($is_luld_tier1)
    {
        if (is_null($is_luld_tier1)) {
            throw new \InvalidArgumentException('non-nullable is_luld_tier1 cannot be null');
        }
        $this->container['is_luld_tier1'] = $is_luld_tier1;

        return $this;
    }

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

    /**
     * Sets is_luld_tier2
     *
     * @param bool|null $is_luld_tier2 Indicates if LULD Tier is 'Tier 2 NMS Stock' (0x2).
     *
     * @return self
     */
    public function setIsLuldTier2($is_luld_tier2)
    {
        if (is_null($is_luld_tier2)) {
            throw new \InvalidArgumentException('non-nullable is_luld_tier2 cannot be null');
        }
        $this->container['is_luld_tier2'] = $is_luld_tier2;

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


