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

/**
 * AdminAdminMessageModel Class Doc Comment
 *
 * @category Class
 * @description Represents the response DTO for IEX admin information, combining all symbol-based admin message types
 * @package  OpenAPI\Client
 * @author   OpenAPI Generator team
 * @link     https://openapi-generator.tech
 * @implements \ArrayAccess<string, mixed>
 */
class AdminAdminMessageModel implements ModelInterface, ArrayAccess, \JsonSerializable
{
    public const DISCRIMINATOR = null;

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

    /**
      * Array of property to type mappings. Used for (de)serialization
      *
      * @var string[]
      */
    protected static $openAPITypes = [
        'trading_status' => '\OpenAPI\Client\Model\AdminTradingStatusModel',
        'official_price' => '\OpenAPI\Client\Model\AdminOfficialPriceModel',
        'security_event' => '\OpenAPI\Client\Model\AdminSecurityEventModel',
        'auction_information' => '\OpenAPI\Client\Model\AdminAuctionInformationModel',
        'short_sale_price_test' => '\OpenAPI\Client\Model\AdminShortSalePriceTestStatusModel',
        'operational_halt_status' => '\OpenAPI\Client\Model\AdminOperationalHaltStatusModel',
        'retail_liquidity_indicator' => '\OpenAPI\Client\Model\AdminRetailLiquidityIndicatorModel',
        'system_event' => '\OpenAPI\Client\Model\AdminSystemEventModel',
        'security_directory' => '\OpenAPI\Client\Model\AdminSecurityDirectoryModel'
    ];

    /**
      * 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 = [
        'trading_status' => null,
        'official_price' => null,
        'security_event' => null,
        'auction_information' => null,
        'short_sale_price_test' => null,
        'operational_halt_status' => null,
        'retail_liquidity_indicator' => null,
        'system_event' => null,
        'security_directory' => null
    ];

    /**
      * Array of nullable properties. Used for (de)serialization
      *
      * @var boolean[]
      */
    protected static array $openAPINullables = [
        'trading_status' => false,
        'official_price' => false,
        'security_event' => false,
        'auction_information' => false,
        'short_sale_price_test' => false,
        'operational_halt_status' => false,
        'retail_liquidity_indicator' => false,
        'system_event' => false,
        'security_directory' => 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 = [
        'trading_status' => 'trading_status',
        'official_price' => 'official_price',
        'security_event' => 'security_event',
        'auction_information' => 'auction_information',
        'short_sale_price_test' => 'short_sale_price_test',
        'operational_halt_status' => 'operational_halt_status',
        'retail_liquidity_indicator' => 'retail_liquidity_indicator',
        'system_event' => 'system_event',
        'security_directory' => 'security_directory'
    ];

    /**
     * Array of attributes to setter functions (for deserialization of responses)
     *
     * @var string[]
     */
    protected static $setters = [
        'trading_status' => 'setTradingStatus',
        'official_price' => 'setOfficialPrice',
        'security_event' => 'setSecurityEvent',
        'auction_information' => 'setAuctionInformation',
        'short_sale_price_test' => 'setShortSalePriceTest',
        'operational_halt_status' => 'setOperationalHaltStatus',
        'retail_liquidity_indicator' => 'setRetailLiquidityIndicator',
        'system_event' => 'setSystemEvent',
        'security_directory' => 'setSecurityDirectory'
    ];

    /**
     * Array of attributes to getter functions (for serialization of requests)
     *
     * @var string[]
     */
    protected static $getters = [
        'trading_status' => 'getTradingStatus',
        'official_price' => 'getOfficialPrice',
        'security_event' => 'getSecurityEvent',
        'auction_information' => 'getAuctionInformation',
        'short_sale_price_test' => 'getShortSalePriceTest',
        'operational_halt_status' => 'getOperationalHaltStatus',
        'retail_liquidity_indicator' => 'getRetailLiquidityIndicator',
        'system_event' => 'getSystemEvent',
        'security_directory' => 'getSecurityDirectory'
    ];

    /**
     * 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('trading_status', $data ?? [], null);
        $this->setIfExists('official_price', $data ?? [], null);
        $this->setIfExists('security_event', $data ?? [], null);
        $this->setIfExists('auction_information', $data ?? [], null);
        $this->setIfExists('short_sale_price_test', $data ?? [], null);
        $this->setIfExists('operational_halt_status', $data ?? [], null);
        $this->setIfExists('retail_liquidity_indicator', $data ?? [], null);
        $this->setIfExists('system_event', $data ?? [], null);
        $this->setIfExists('security_directory', $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 trading_status
     *
     * @return \OpenAPI\Client\Model\AdminTradingStatusModel|null
     */
    public function getTradingStatus()
    {
        return $this->container['trading_status'];
    }

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

        return $this;
    }

    /**
     * Gets official_price
     *
     * @return \OpenAPI\Client\Model\AdminOfficialPriceModel|null
     */
    public function getOfficialPrice()
    {
        return $this->container['official_price'];
    }

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

        return $this;
    }

    /**
     * Gets security_event
     *
     * @return \OpenAPI\Client\Model\AdminSecurityEventModel|null
     */
    public function getSecurityEvent()
    {
        return $this->container['security_event'];
    }

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

        return $this;
    }

    /**
     * Gets auction_information
     *
     * @return \OpenAPI\Client\Model\AdminAuctionInformationModel|null
     */
    public function getAuctionInformation()
    {
        return $this->container['auction_information'];
    }

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

        return $this;
    }

    /**
     * Gets short_sale_price_test
     *
     * @return \OpenAPI\Client\Model\AdminShortSalePriceTestStatusModel|null
     */
    public function getShortSalePriceTest()
    {
        return $this->container['short_sale_price_test'];
    }

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

        return $this;
    }

    /**
     * Gets operational_halt_status
     *
     * @return \OpenAPI\Client\Model\AdminOperationalHaltStatusModel|null
     */
    public function getOperationalHaltStatus()
    {
        return $this->container['operational_halt_status'];
    }

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

        return $this;
    }

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

    /**
     * Sets retail_liquidity_indicator
     *
     * @param \OpenAPI\Client\Model\AdminRetailLiquidityIndicatorModel|null $retail_liquidity_indicator retail_liquidity_indicator
     *
     * @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 system_event
     *
     * @return \OpenAPI\Client\Model\AdminSystemEventModel|null
     */
    public function getSystemEvent()
    {
        return $this->container['system_event'];
    }

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

        return $this;
    }

    /**
     * Gets security_directory
     *
     * @return \OpenAPI\Client\Model\AdminSecurityDirectoryModel|null
     */
    public function getSecurityDirectory()
    {
        return $this->container['security_directory'];
    }

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

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


