<?php

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

/**
 * Sync Core.
 *
 * The Sync Core that sends and receives content from all connected sites and services for Content Sync.
 *
 * The version of the OpenAPI document: 1.0
 * Generated by: https://openapi-generator.tech
 * OpenAPI Generator version: 6.4.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 EdgeBox\SyncCore\V2\Raw\Model;

use EdgeBox\SyncCore\V2\Raw\ObjectSerializer;

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

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

    /**
     * Array of property to type mappings. Used for (de)serialization.
     *
     * @var string[]
     */
    protected static $openAPITypes = [
        'accessKeyIds' => 'string[]',
        'key' => 'string',
        'targetType' => 'ServiceSecretTargetType',
        'targetId' => 'string',
        'version' => 'float',
        'status' => 'ServiceSecretStatus',
        'previousStatus' => 'ServiceSecretStatus',
        'revisionArchivedAt' => 'float',
        'name' => 'string',
        'accessKeyName' => 'string',
        'accessKeySetAt' => 'float',
        'accessKeyArchivedAt' => 'float',
        'customer' => 'DynamicReference',
        'project' => 'DynamicReference',
        'id' => 'string',
        'createdAt' => 'float',
        'updatedAt' => 'float',
        'deletedAt' => 'float',
        'accessKeyEncrypted' => 'mixed',
    ];

    /**
     * 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 = [
        'accessKeyIds' => null,
        'key' => null,
        'targetType' => null,
        'targetId' => null,
        'version' => null,
        'status' => null,
        'previousStatus' => null,
        'revisionArchivedAt' => null,
        'name' => null,
        'accessKeyName' => null,
        'accessKeySetAt' => null,
        'accessKeyArchivedAt' => null,
        'customer' => null,
        'project' => null,
        'id' => null,
        'createdAt' => null,
        'updatedAt' => null,
        'deletedAt' => null,
        'accessKeyEncrypted' => null,
    ];

    /**
     * Array of nullable properties. Used for (de)serialization.
     *
     * @var bool[]
     */
    protected static array $openAPINullables = [
        'accessKeyIds' => false,
        'key' => false,
        'targetType' => false,
        'targetId' => false,
        'version' => false,
        'status' => false,
        'previousStatus' => true,
        'revisionArchivedAt' => true,
        'name' => false,
        'accessKeyName' => true,
        'accessKeySetAt' => true,
        'accessKeyArchivedAt' => true,
        'customer' => true,
        'project' => true,
        'id' => false,
        'createdAt' => false,
        'updatedAt' => false,
        'deletedAt' => true,
        'accessKeyEncrypted' => true,
    ];

    /**
     * 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 = [
        'accessKeyIds' => 'accessKeyIds',
        'key' => 'key',
        'targetType' => 'targetType',
        'targetId' => 'targetId',
        'version' => 'version',
        'status' => 'status',
        'previousStatus' => 'previousStatus',
        'revisionArchivedAt' => 'revisionArchivedAt',
        'name' => 'name',
        'accessKeyName' => 'accessKeyName',
        'accessKeySetAt' => 'accessKeySetAt',
        'accessKeyArchivedAt' => 'accessKeyArchivedAt',
        'customer' => 'customer',
        'project' => 'project',
        'id' => 'id',
        'createdAt' => 'createdAt',
        'updatedAt' => 'updatedAt',
        'deletedAt' => 'deletedAt',
        'accessKeyEncrypted' => 'accessKeyEncrypted',
    ];

    /**
     * Array of attributes to setter functions (for deserialization of responses).
     *
     * @var string[]
     */
    protected static $setters = [
        'accessKeyIds' => 'setAccessKeyIds',
        'key' => 'setKey',
        'targetType' => 'setTargetType',
        'targetId' => 'setTargetId',
        'version' => 'setVersion',
        'status' => 'setStatus',
        'previousStatus' => 'setPreviousStatus',
        'revisionArchivedAt' => 'setRevisionArchivedAt',
        'name' => 'setName',
        'accessKeyName' => 'setAccessKeyName',
        'accessKeySetAt' => 'setAccessKeySetAt',
        'accessKeyArchivedAt' => 'setAccessKeyArchivedAt',
        'customer' => 'setCustomer',
        'project' => 'setProject',
        'id' => 'setId',
        'createdAt' => 'setCreatedAt',
        'updatedAt' => 'setUpdatedAt',
        'deletedAt' => 'setDeletedAt',
        'accessKeyEncrypted' => 'setAccessKeyEncrypted',
    ];

    /**
     * Array of attributes to getter functions (for serialization of requests).
     *
     * @var string[]
     */
    protected static $getters = [
        'accessKeyIds' => 'getAccessKeyIds',
        'key' => 'getKey',
        'targetType' => 'getTargetType',
        'targetId' => 'getTargetId',
        'version' => 'getVersion',
        'status' => 'getStatus',
        'previousStatus' => 'getPreviousStatus',
        'revisionArchivedAt' => 'getRevisionArchivedAt',
        'name' => 'getName',
        'accessKeyName' => 'getAccessKeyName',
        'accessKeySetAt' => 'getAccessKeySetAt',
        'accessKeyArchivedAt' => 'getAccessKeyArchivedAt',
        'customer' => 'getCustomer',
        'project' => 'getProject',
        'id' => 'getId',
        'createdAt' => 'getCreatedAt',
        'updatedAt' => 'getUpdatedAt',
        'deletedAt' => 'getDeletedAt',
        'accessKeyEncrypted' => 'getAccessKeyEncrypted',
    ];

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

    /**
     * Constructor.
     *
     * @param mixed[] $data Associated array of property values
     *                      initializing the model
     */
    public function __construct(?array $data = null)
    {
        $this->setIfExists('accessKeyIds', $data ?? [], null);
        $this->setIfExists('key', $data ?? [], null);
        $this->setIfExists('targetType', $data ?? [], null);
        $this->setIfExists('targetId', $data ?? [], null);
        $this->setIfExists('version', $data ?? [], null);
        $this->setIfExists('status', $data ?? [], null);
        $this->setIfExists('previousStatus', $data ?? [], null);
        $this->setIfExists('revisionArchivedAt', $data ?? [], null);
        $this->setIfExists('name', $data ?? [], null);
        $this->setIfExists('accessKeyName', $data ?? [], null);
        $this->setIfExists('accessKeySetAt', $data ?? [], null);
        $this->setIfExists('accessKeyArchivedAt', $data ?? [], null);
        $this->setIfExists('customer', $data ?? [], null);
        $this->setIfExists('project', $data ?? [], null);
        $this->setIfExists('id', $data ?? [], null);
        $this->setIfExists('createdAt', $data ?? [], null);
        $this->setIfExists('updatedAt', $data ?? [], null);
        $this->setIfExists('deletedAt', $data ?? [], null);
        $this->setIfExists('accessKeyEncrypted', $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;
    }

    /**
     * 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()
    {
        $invalidProperties = [];

        if (null === $this->container['accessKeyIds']) {
            $invalidProperties[] = "'accessKeyIds' can't be null";
        }
        if (null === $this->container['key']) {
            $invalidProperties[] = "'key' can't be null";
        }
        if (null === $this->container['targetType']) {
            $invalidProperties[] = "'targetType' can't be null";
        }
        if (null === $this->container['targetId']) {
            $invalidProperties[] = "'targetId' can't be null";
        }
        if (null === $this->container['version']) {
            $invalidProperties[] = "'version' can't be null";
        }
        if (null === $this->container['status']) {
            $invalidProperties[] = "'status' can't be null";
        }
        if (null === $this->container['name']) {
            $invalidProperties[] = "'name' can't be null";
        }
        if (null === $this->container['id']) {
            $invalidProperties[] = "'id' can't be null";
        }
        if (null === $this->container['createdAt']) {
            $invalidProperties[] = "'createdAt' can't be null";
        }
        if (null === $this->container['updatedAt']) {
            $invalidProperties[] = "'updatedAt' can't be null";
        }

        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 0 === count($this->listInvalidProperties());
    }

    /**
     * Gets accessKeyIds.
     *
     * @return string[]
     */
    public function getAccessKeyIds()
    {
        return $this->container['accessKeyIds'];
    }

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

        return $this;
    }

    /**
     * Gets key.
     *
     * @return string
     */
    public function getKey()
    {
        return $this->container['key'];
    }

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

        return $this;
    }

    /**
     * Gets targetType.
     *
     * @return ServiceSecretTargetType
     */
    public function getTargetType()
    {
        return $this->container['targetType'];
    }

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

        return $this;
    }

    /**
     * Gets targetId.
     *
     * @return string
     */
    public function getTargetId()
    {
        return $this->container['targetId'];
    }

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

        return $this;
    }

    /**
     * Gets version.
     *
     * @return float
     */
    public function getVersion()
    {
        return $this->container['version'];
    }

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

        return $this;
    }

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

    /**
     * Sets status.
     *
     * @param ServiceSecretStatus $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 previousStatus.
     *
     * @return null|ServiceSecretStatus
     */
    public function getPreviousStatus()
    {
        return $this->container['previousStatus'];
    }

    /**
     * Sets previousStatus.
     *
     * @param null|ServiceSecretStatus $previousStatus previousStatus
     *
     * @return self
     */
    public function setPreviousStatus($previousStatus)
    {
        if (is_null($previousStatus)) {
            array_push($this->openAPINullablesSetToNull, 'previousStatus');
        } else {
            $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
            $index = array_search('previousStatus', $nullablesSetToNull);
            if (false !== $index) {
                unset($nullablesSetToNull[$index]);
                $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
            }
        }
        $this->container['previousStatus'] = $previousStatus;

        return $this;
    }

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

    /**
     * Sets revisionArchivedAt.
     *
     * @param null|float $revisionArchivedAt revisionArchivedAt
     *
     * @return self
     */
    public function setRevisionArchivedAt($revisionArchivedAt)
    {
        if (is_null($revisionArchivedAt)) {
            array_push($this->openAPINullablesSetToNull, 'revisionArchivedAt');
        } else {
            $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
            $index = array_search('revisionArchivedAt', $nullablesSetToNull);
            if (false !== $index) {
                unset($nullablesSetToNull[$index]);
                $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
            }
        }
        $this->container['revisionArchivedAt'] = $revisionArchivedAt;

        return $this;
    }

    /**
     * Gets name.
     *
     * @return string
     */
    public function getName()
    {
        return $this->container['name'];
    }

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

        return $this;
    }

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

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

        return $this;
    }

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

    /**
     * Sets accessKeySetAt.
     *
     * @param null|float $accessKeySetAt accessKeySetAt
     *
     * @return self
     */
    public function setAccessKeySetAt($accessKeySetAt)
    {
        if (is_null($accessKeySetAt)) {
            array_push($this->openAPINullablesSetToNull, 'accessKeySetAt');
        } else {
            $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
            $index = array_search('accessKeySetAt', $nullablesSetToNull);
            if (false !== $index) {
                unset($nullablesSetToNull[$index]);
                $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
            }
        }
        $this->container['accessKeySetAt'] = $accessKeySetAt;

        return $this;
    }

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

    /**
     * Sets accessKeyArchivedAt.
     *
     * @param null|float $accessKeyArchivedAt accessKeyArchivedAt
     *
     * @return self
     */
    public function setAccessKeyArchivedAt($accessKeyArchivedAt)
    {
        if (is_null($accessKeyArchivedAt)) {
            array_push($this->openAPINullablesSetToNull, 'accessKeyArchivedAt');
        } else {
            $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
            $index = array_search('accessKeyArchivedAt', $nullablesSetToNull);
            if (false !== $index) {
                unset($nullablesSetToNull[$index]);
                $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
            }
        }
        $this->container['accessKeyArchivedAt'] = $accessKeyArchivedAt;

        return $this;
    }

    /**
     * Gets customer.
     *
     * @return null|DynamicReference
     */
    public function getCustomer()
    {
        return $this->container['customer'];
    }

    /**
     * Sets customer.
     *
     * @param null|DynamicReference $customer customer
     *
     * @return self
     */
    public function setCustomer($customer)
    {
        if (is_null($customer)) {
            array_push($this->openAPINullablesSetToNull, 'customer');
        } else {
            $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
            $index = array_search('customer', $nullablesSetToNull);
            if (false !== $index) {
                unset($nullablesSetToNull[$index]);
                $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
            }
        }
        $this->container['customer'] = $customer;

        return $this;
    }

    /**
     * Gets project.
     *
     * @return null|DynamicReference
     */
    public function getProject()
    {
        return $this->container['project'];
    }

    /**
     * Sets project.
     *
     * @param null|DynamicReference $project project
     *
     * @return self
     */
    public function setProject($project)
    {
        if (is_null($project)) {
            array_push($this->openAPINullablesSetToNull, 'project');
        } else {
            $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
            $index = array_search('project', $nullablesSetToNull);
            if (false !== $index) {
                unset($nullablesSetToNull[$index]);
                $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
            }
        }
        $this->container['project'] = $project;

        return $this;
    }

    /**
     * Gets id.
     *
     * @return string
     */
    public function getId()
    {
        return $this->container['id'];
    }

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

        return $this;
    }

    /**
     * Gets createdAt.
     *
     * @return float
     */
    public function getCreatedAt()
    {
        return $this->container['createdAt'];
    }

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

        return $this;
    }

    /**
     * Gets updatedAt.
     *
     * @return float
     */
    public function getUpdatedAt()
    {
        return $this->container['updatedAt'];
    }

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

        return $this;
    }

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

    /**
     * Sets deletedAt.
     *
     * @param null|float $deletedAt deletedAt
     *
     * @return self
     */
    public function setDeletedAt($deletedAt)
    {
        if (is_null($deletedAt)) {
            array_push($this->openAPINullablesSetToNull, 'deletedAt');
        } else {
            $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
            $index = array_search('deletedAt', $nullablesSetToNull);
            if (false !== $index) {
                unset($nullablesSetToNull[$index]);
                $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
            }
        }
        $this->container['deletedAt'] = $deletedAt;

        return $this;
    }

    /**
     * Gets accessKeyEncrypted.
     *
     * @return null|mixed
     */
    public function getAccessKeyEncrypted()
    {
        return $this->container['accessKeyEncrypted'];
    }

    /**
     * Sets accessKeyEncrypted.
     *
     * @param null|mixed $accessKeyEncrypted accessKeyEncrypted
     *
     * @return self
     */
    public function setAccessKeyEncrypted($accessKeyEncrypted)
    {
        if (is_null($accessKeyEncrypted)) {
            array_push($this->openAPINullablesSetToNull, 'accessKeyEncrypted');
        } else {
            $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
            $index = array_search('accessKeyEncrypted', $nullablesSetToNull);
            if (false !== $index) {
                unset($nullablesSetToNull[$index]);
                $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
            }
        }
        $this->container['accessKeyEncrypted'] = $accessKeyEncrypted;

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