<?php

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

/**
 * Binance Derivatives Trading USDS Futures REST API.
 *
 * OpenAPI Specification for the Binance Derivatives Trading USDS Futures REST API
 *
 * 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\DerivativesTradingUsdsFutures\Model;

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

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

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

    /**
     * Array of property to type mappings. Used for (de)serialization.
     *
     * @var string[]
     */
    protected static $openAPITypes = [
        'orderId' => 'int',
        'symbol' => 'string',
        'pair' => 'string',
        'status' => 'string',
        'clientOrderId' => 'string',
        'price' => 'string',
        'avgPrice' => 'string',
        'origQty' => 'string',
        'executedQty' => 'string',
        'cumQty' => 'string',
        'cumBase' => 'string',
        'timeInForce' => 'string',
        'type' => 'string',
        'reduceOnly' => 'bool',
        'closePosition' => 'bool',
        'side' => 'string',
        'positionSide' => 'string',
        'stopPrice' => 'string',
        'workingType' => 'string',
        'priceProtect' => 'bool',
        'origType' => 'string',
        'priceMatch' => 'string',
        'selfTradePreventionMode' => 'string',
        'goodTillDate' => 'int',
        'updateTime' => 'int',
    ];

    /**
     * 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 = [
        'orderId' => 'int64',
        'symbol' => null,
        'pair' => null,
        'status' => null,
        'clientOrderId' => null,
        'price' => null,
        'avgPrice' => null,
        'origQty' => null,
        'executedQty' => null,
        'cumQty' => null,
        'cumBase' => null,
        'timeInForce' => null,
        'type' => null,
        'reduceOnly' => null,
        'closePosition' => null,
        'side' => null,
        'positionSide' => null,
        'stopPrice' => null,
        'workingType' => null,
        'priceProtect' => null,
        'origType' => null,
        'priceMatch' => null,
        'selfTradePreventionMode' => null,
        'goodTillDate' => 'int64',
        'updateTime' => 'int64',
    ];

    /**
     * Array of nullable properties. Used for (de)serialization.
     *
     * @var bool[]
     */
    protected static array $openAPINullables = [
        'orderId' => false,
        'symbol' => false,
        'pair' => false,
        'status' => false,
        'clientOrderId' => false,
        'price' => false,
        'avgPrice' => false,
        'origQty' => false,
        'executedQty' => false,
        'cumQty' => false,
        'cumBase' => false,
        'timeInForce' => false,
        'type' => false,
        'reduceOnly' => false,
        'closePosition' => false,
        'side' => false,
        'positionSide' => false,
        'stopPrice' => false,
        'workingType' => false,
        'priceProtect' => false,
        'origType' => false,
        'priceMatch' => false,
        'selfTradePreventionMode' => false,
        'goodTillDate' => false,
        'updateTime' => 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 = [
        'orderId' => 'orderId',
        'symbol' => 'symbol',
        'pair' => 'pair',
        'status' => 'status',
        'clientOrderId' => 'clientOrderId',
        'price' => 'price',
        'avgPrice' => 'avgPrice',
        'origQty' => 'origQty',
        'executedQty' => 'executedQty',
        'cumQty' => 'cumQty',
        'cumBase' => 'cumBase',
        'timeInForce' => 'timeInForce',
        'type' => 'type',
        'reduceOnly' => 'reduceOnly',
        'closePosition' => 'closePosition',
        'side' => 'side',
        'positionSide' => 'positionSide',
        'stopPrice' => 'stopPrice',
        'workingType' => 'workingType',
        'priceProtect' => 'priceProtect',
        'origType' => 'origType',
        'priceMatch' => 'priceMatch',
        'selfTradePreventionMode' => 'selfTradePreventionMode',
        'goodTillDate' => 'goodTillDate',
        'updateTime' => 'updateTime',
    ];

    /**
     * Array of attributes to setter functions (for deserialization of responses).
     *
     * @var string[]
     */
    protected static $setters = [
        'orderId' => 'setOrderId',
        'symbol' => 'setSymbol',
        'pair' => 'setPair',
        'status' => 'setStatus',
        'clientOrderId' => 'setClientOrderId',
        'price' => 'setPrice',
        'avgPrice' => 'setAvgPrice',
        'origQty' => 'setOrigQty',
        'executedQty' => 'setExecutedQty',
        'cumQty' => 'setCumQty',
        'cumBase' => 'setCumBase',
        'timeInForce' => 'setTimeInForce',
        'type' => 'setType',
        'reduceOnly' => 'setReduceOnly',
        'closePosition' => 'setClosePosition',
        'side' => 'setSide',
        'positionSide' => 'setPositionSide',
        'stopPrice' => 'setStopPrice',
        'workingType' => 'setWorkingType',
        'priceProtect' => 'setPriceProtect',
        'origType' => 'setOrigType',
        'priceMatch' => 'setPriceMatch',
        'selfTradePreventionMode' => 'setSelfTradePreventionMode',
        'goodTillDate' => 'setGoodTillDate',
        'updateTime' => 'setUpdateTime',
    ];

    /**
     * Array of attributes to getter functions (for serialization of requests).
     *
     * @var string[]
     */
    protected static $getters = [
        'orderId' => 'getOrderId',
        'symbol' => 'getSymbol',
        'pair' => 'getPair',
        'status' => 'getStatus',
        'clientOrderId' => 'getClientOrderId',
        'price' => 'getPrice',
        'avgPrice' => 'getAvgPrice',
        'origQty' => 'getOrigQty',
        'executedQty' => 'getExecutedQty',
        'cumQty' => 'getCumQty',
        'cumBase' => 'getCumBase',
        'timeInForce' => 'getTimeInForce',
        'type' => 'getType',
        'reduceOnly' => 'getReduceOnly',
        'closePosition' => 'getClosePosition',
        'side' => 'getSide',
        'positionSide' => 'getPositionSide',
        'stopPrice' => 'getStopPrice',
        'workingType' => 'getWorkingType',
        'priceProtect' => 'getPriceProtect',
        'origType' => 'getOrigType',
        'priceMatch' => 'getPriceMatch',
        'selfTradePreventionMode' => 'getSelfTradePreventionMode',
        'goodTillDate' => 'getGoodTillDate',
        'updateTime' => 'getUpdateTime',
    ];

    /**
     * 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('orderId', $data ?? [], null);
        $this->setIfExists('symbol', $data ?? [], null);
        $this->setIfExists('pair', $data ?? [], null);
        $this->setIfExists('status', $data ?? [], null);
        $this->setIfExists('clientOrderId', $data ?? [], null);
        $this->setIfExists('price', $data ?? [], null);
        $this->setIfExists('avgPrice', $data ?? [], null);
        $this->setIfExists('origQty', $data ?? [], null);
        $this->setIfExists('executedQty', $data ?? [], null);
        $this->setIfExists('cumQty', $data ?? [], null);
        $this->setIfExists('cumBase', $data ?? [], null);
        $this->setIfExists('timeInForce', $data ?? [], null);
        $this->setIfExists('type', $data ?? [], null);
        $this->setIfExists('reduceOnly', $data ?? [], null);
        $this->setIfExists('closePosition', $data ?? [], null);
        $this->setIfExists('side', $data ?? [], null);
        $this->setIfExists('positionSide', $data ?? [], null);
        $this->setIfExists('stopPrice', $data ?? [], null);
        $this->setIfExists('workingType', $data ?? [], null);
        $this->setIfExists('priceProtect', $data ?? [], null);
        $this->setIfExists('origType', $data ?? [], null);
        $this->setIfExists('priceMatch', $data ?? [], null);
        $this->setIfExists('selfTradePreventionMode', $data ?? [], null);
        $this->setIfExists('goodTillDate', $data ?? [], null);
        $this->setIfExists('updateTime', $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 orderId.
     *
     * @return null|int
     */
    public function getOrderId()
    {
        return $this->container['orderId'];
    }

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

        return $this;
    }

    /**
     * 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 pair.
     *
     * @return null|string
     */
    public function getPair()
    {
        return $this->container['pair'];
    }

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

        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 clientOrderId.
     *
     * @return null|string
     */
    public function getClientOrderId()
    {
        return $this->container['clientOrderId'];
    }

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

        return $this;
    }

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

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

        return $this;
    }

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

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

        return $this;
    }

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

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

        return $this;
    }

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

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

        return $this;
    }

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

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

        return $this;
    }

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

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

        return $this;
    }

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

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

        return $this;
    }

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

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

        return $this;
    }

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

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

        return $this;
    }

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

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

        return $this;
    }

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

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

        return $this;
    }

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

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

        return $this;
    }

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

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

        return $this;
    }

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

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

        return $this;
    }

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

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

        return $this;
    }

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

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

        return $this;
    }

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

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

        return $this;
    }

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

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

        return $this;
    }

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

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

        return $this;
    }

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

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

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