<?php

/**
 * ExchangeInfoResponseSymbolsInner.
 *
 * PHP version 8.1
 *
 * @category Class
 *
 * @author   OpenAPI Generator team
 *
 * @see     https://openapi-generator.tech
 */

/**
 * Binance Spot REST API.
 *
 * OpenAPI Specifications for the Binance Spot REST API  API documents:   - [Github rest-api documentation file](https://github.com/binance/binance-spot-api-docs/blob/master/rest-api.md)   - [General API information for rest-api on website](https://developers.binance.com/docs/binance-spot-api-docs/rest-api/general-api-information)
 *
 * The version of the OpenAPI document: 1.0.0
 * Generated by: https://openapi-generator.tech
 * Generator version: 7.12.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 Binance\Client\Spot\Model;

use Binance\Common\Dtos\ModelInterface;
use Binance\Common\ObjectSerializer;

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

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

    /**
     * Array of property to type mappings. Used for (de)serialization.
     *
     * @var string[]
     */
    protected static $openAPITypes = [
        'symbol' => 'string',
        'status' => 'string',
        'baseAsset' => 'string',
        'baseAssetPrecision' => 'int',
        'quoteAsset' => 'string',
        'quotePrecision' => 'int',
        'quoteAssetPrecision' => 'int',
        'baseCommissionPrecision' => 'int',
        'quoteCommissionPrecision' => 'int',
        'orderTypes' => 'string[]',
        'icebergAllowed' => 'bool',
        'ocoAllowed' => 'bool',
        'otoAllowed' => 'bool',
        'quoteOrderQtyMarketAllowed' => 'bool',
        'allowTrailingStop' => 'bool',
        'cancelReplaceAllowed' => 'bool',
        'amendAllowed' => 'bool',
        'isSpotTradingAllowed' => 'bool',
        'isMarginTradingAllowed' => 'bool',
        'filters' => '\Binance\Client\Spot\Model\ExchangeFilters',
        'permissions' => 'string[]',
        'permissionSets' => 'string[][]',
        'defaultSelfTradePreventionMode' => 'string',
        'allowedSelfTradePreventionModes' => '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 = [
        'symbol' => null,
        'status' => null,
        'baseAsset' => null,
        'baseAssetPrecision' => 'int64',
        'quoteAsset' => null,
        'quotePrecision' => 'int64',
        'quoteAssetPrecision' => 'int64',
        'baseCommissionPrecision' => 'int64',
        'quoteCommissionPrecision' => 'int64',
        'orderTypes' => null,
        'icebergAllowed' => null,
        'ocoAllowed' => null,
        'otoAllowed' => null,
        'quoteOrderQtyMarketAllowed' => null,
        'allowTrailingStop' => null,
        'cancelReplaceAllowed' => null,
        'amendAllowed' => null,
        'isSpotTradingAllowed' => null,
        'isMarginTradingAllowed' => null,
        'filters' => null,
        'permissions' => null,
        'permissionSets' => null,
        'defaultSelfTradePreventionMode' => null,
        'allowedSelfTradePreventionModes' => null,
    ];

    /**
     * Array of nullable properties. Used for (de)serialization.
     *
     * @var bool[]
     */
    protected static array $openAPINullables = [
        'symbol' => false,
        'status' => false,
        'baseAsset' => false,
        'baseAssetPrecision' => false,
        'quoteAsset' => false,
        'quotePrecision' => false,
        'quoteAssetPrecision' => false,
        'baseCommissionPrecision' => false,
        'quoteCommissionPrecision' => false,
        'orderTypes' => false,
        'icebergAllowed' => false,
        'ocoAllowed' => false,
        'otoAllowed' => false,
        'quoteOrderQtyMarketAllowed' => false,
        'allowTrailingStop' => false,
        'cancelReplaceAllowed' => false,
        'amendAllowed' => false,
        'isSpotTradingAllowed' => false,
        'isMarginTradingAllowed' => false,
        'filters' => false,
        'permissions' => false,
        'permissionSets' => false,
        'defaultSelfTradePreventionMode' => false,
        'allowedSelfTradePreventionModes' => false,
    ];

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

    /**
     * Array of attributes where the key is the local name,
     * and the value is the original name.
     *
     * @var string[]
     */
    protected static $attributeMap = [
        'symbol' => 'symbol',
        'status' => 'status',
        'baseAsset' => 'baseAsset',
        'baseAssetPrecision' => 'baseAssetPrecision',
        'quoteAsset' => 'quoteAsset',
        'quotePrecision' => 'quotePrecision',
        'quoteAssetPrecision' => 'quoteAssetPrecision',
        'baseCommissionPrecision' => 'baseCommissionPrecision',
        'quoteCommissionPrecision' => 'quoteCommissionPrecision',
        'orderTypes' => 'orderTypes',
        'icebergAllowed' => 'icebergAllowed',
        'ocoAllowed' => 'ocoAllowed',
        'otoAllowed' => 'otoAllowed',
        'quoteOrderQtyMarketAllowed' => 'quoteOrderQtyMarketAllowed',
        'allowTrailingStop' => 'allowTrailingStop',
        'cancelReplaceAllowed' => 'cancelReplaceAllowed',
        'amendAllowed' => 'amendAllowed',
        'isSpotTradingAllowed' => 'isSpotTradingAllowed',
        'isMarginTradingAllowed' => 'isMarginTradingAllowed',
        'filters' => 'filters',
        'permissions' => 'permissions',
        'permissionSets' => 'permissionSets',
        'defaultSelfTradePreventionMode' => 'defaultSelfTradePreventionMode',
        'allowedSelfTradePreventionModes' => 'allowedSelfTradePreventionModes',
    ];

    /**
     * Array of attributes to setter functions (for deserialization of responses).
     *
     * @var string[]
     */
    protected static $setters = [
        'symbol' => 'setSymbol',
        'status' => 'setStatus',
        'baseAsset' => 'setBaseAsset',
        'baseAssetPrecision' => 'setBaseAssetPrecision',
        'quoteAsset' => 'setQuoteAsset',
        'quotePrecision' => 'setQuotePrecision',
        'quoteAssetPrecision' => 'setQuoteAssetPrecision',
        'baseCommissionPrecision' => 'setBaseCommissionPrecision',
        'quoteCommissionPrecision' => 'setQuoteCommissionPrecision',
        'orderTypes' => 'setOrderTypes',
        'icebergAllowed' => 'setIcebergAllowed',
        'ocoAllowed' => 'setOcoAllowed',
        'otoAllowed' => 'setOtoAllowed',
        'quoteOrderQtyMarketAllowed' => 'setQuoteOrderQtyMarketAllowed',
        'allowTrailingStop' => 'setAllowTrailingStop',
        'cancelReplaceAllowed' => 'setCancelReplaceAllowed',
        'amendAllowed' => 'setAmendAllowed',
        'isSpotTradingAllowed' => 'setIsSpotTradingAllowed',
        'isMarginTradingAllowed' => 'setIsMarginTradingAllowed',
        'filters' => 'setFilters',
        'permissions' => 'setPermissions',
        'permissionSets' => 'setPermissionSets',
        'defaultSelfTradePreventionMode' => 'setDefaultSelfTradePreventionMode',
        'allowedSelfTradePreventionModes' => 'setAllowedSelfTradePreventionModes',
    ];

    /**
     * Array of attributes to getter functions (for serialization of requests).
     *
     * @var string[]
     */
    protected static $getters = [
        'symbol' => 'getSymbol',
        'status' => 'getStatus',
        'baseAsset' => 'getBaseAsset',
        'baseAssetPrecision' => 'getBaseAssetPrecision',
        'quoteAsset' => 'getQuoteAsset',
        'quotePrecision' => 'getQuotePrecision',
        'quoteAssetPrecision' => 'getQuoteAssetPrecision',
        'baseCommissionPrecision' => 'getBaseCommissionPrecision',
        'quoteCommissionPrecision' => 'getQuoteCommissionPrecision',
        'orderTypes' => 'getOrderTypes',
        'icebergAllowed' => 'getIcebergAllowed',
        'ocoAllowed' => 'getOcoAllowed',
        'otoAllowed' => 'getOtoAllowed',
        'quoteOrderQtyMarketAllowed' => 'getQuoteOrderQtyMarketAllowed',
        'allowTrailingStop' => 'getAllowTrailingStop',
        'cancelReplaceAllowed' => 'getCancelReplaceAllowed',
        'amendAllowed' => 'getAmendAllowed',
        'isSpotTradingAllowed' => 'getIsSpotTradingAllowed',
        'isMarginTradingAllowed' => 'getIsMarginTradingAllowed',
        'filters' => 'getFilters',
        'permissions' => 'getPermissions',
        'permissionSets' => 'getPermissionSets',
        'defaultSelfTradePreventionMode' => 'getDefaultSelfTradePreventionMode',
        'allowedSelfTradePreventionModes' => 'getAllowedSelfTradePreventionModes',
    ];

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

    /**
     * Constructor.
     *
     * @param null|mixed[] $data Associated array of property values
     *                           initializing the model
     */
    public function __construct(?array $data = null)
    {
        $this->setIfExists('symbol', $data ?? [], null);
        $this->setIfExists('status', $data ?? [], null);
        $this->setIfExists('baseAsset', $data ?? [], null);
        $this->setIfExists('baseAssetPrecision', $data ?? [], null);
        $this->setIfExists('quoteAsset', $data ?? [], null);
        $this->setIfExists('quotePrecision', $data ?? [], null);
        $this->setIfExists('quoteAssetPrecision', $data ?? [], null);
        $this->setIfExists('baseCommissionPrecision', $data ?? [], null);
        $this->setIfExists('quoteCommissionPrecision', $data ?? [], null);
        $this->setIfExists('orderTypes', $data ?? [], null);
        $this->setIfExists('icebergAllowed', $data ?? [], null);
        $this->setIfExists('ocoAllowed', $data ?? [], null);
        $this->setIfExists('otoAllowed', $data ?? [], null);
        $this->setIfExists('quoteOrderQtyMarketAllowed', $data ?? [], null);
        $this->setIfExists('allowTrailingStop', $data ?? [], null);
        $this->setIfExists('cancelReplaceAllowed', $data ?? [], null);
        $this->setIfExists('amendAllowed', $data ?? [], null);
        $this->setIfExists('isSpotTradingAllowed', $data ?? [], null);
        $this->setIfExists('isMarginTradingAllowed', $data ?? [], null);
        $this->setIfExists('filters', $data ?? [], null);
        $this->setIfExists('permissions', $data ?? [], null);
        $this->setIfExists('permissionSets', $data ?? [], null);
        $this->setIfExists('defaultSelfTradePreventionMode', $data ?? [], null);
        $this->setIfExists('allowedSelfTradePreventionModes', $data ?? [], null);
    }

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

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

    /**
     * If oneOf schema, get the possible response types.
     */
    public static function getComposedSchemas(): array
    {
        return [
        ];
    }

    /**
     * Return true if the model is an array.
     */
    public static function isArray(): bool
    {
        return false;
    }

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

    /**
     * Checks if a nullable property is set to null.
     */
    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.
     *
     * @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;
    }

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

    /**
     * Validate all the properties in the model
     * return true if all passed.
     *
     * @return bool True if all properties are valid
     */
    public function valid()
    {
        return 0 === count($this->listInvalidProperties());
    }

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

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

        return $this;
    }

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

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

        return $this;
    }

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

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

        return $this;
    }

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

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

        return $this;
    }

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

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

        return $this;
    }

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

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

        return $this;
    }

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

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

        return $this;
    }

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

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

        return $this;
    }

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

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

        return $this;
    }

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

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

        return $this;
    }

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

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

        return $this;
    }

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

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

        return $this;
    }

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

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

        return $this;
    }

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

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

        return $this;
    }

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

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

        return $this;
    }

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

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

        return $this;
    }

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

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

        return $this;
    }

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

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

        return $this;
    }

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

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

        return $this;
    }

    /**
     * Gets filters.
     *
     * @return null|ExchangeFilters
     */
    public function getFilters()
    {
        return $this->container['filters'];
    }

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

        return $this;
    }

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

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

        return $this;
    }

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

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

        return $this;
    }

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

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

        return $this;
    }

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

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

        return $this;
    }

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

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

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

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

    /**
     * Serializes the object to a value that can be serialized natively by json_encode().
     *
     * @see 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 a header-safe presentation of the object.
     *
     * @return string
     */
    public function toHeaderValue()
    {
        return json_encode(ObjectSerializer::sanitizeForSerialization($this));
    }

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

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

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

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