<?php

/**
 * TaxonomyTermEntity.
 *
 * 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;

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

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

    /**
     * Array of property to type mappings. Used for (de)serialization.
     *
     * @var string[]
     */
    protected static $openAPITypes = [
        'accessScope' => 'AccessScope',
        'accessKeyIds' => 'string[]',
        'taxonomy' => '\EdgeBox\SyncCore\V2\Raw\Model\TaxonomyTermEntityTaxonomy',
        'status' => 'TaxonomyTermStatus',
        'version' => 'float',
        'previousStatus' => 'TaxonomyTermStatus',
        'revisionArchivedAt' => 'float',
        'origin' => 'TaxonomyTermOrigin',
        'key' => 'string',
        'name' => 'string',
        'description' => 'string',
        'classificationPrompt' => 'string',
        'aliases' => 'string[]',
        'collectionTerms' => '\EdgeBox\SyncCore\V2\Raw\Model\DynamicRevisionReference[]',
        'timeFrame' => 'TimeFrame',
        'priority' => 'TaxonomyTermPriority',
        'thirdParty' => 'TaxonomyTermThirdParty',
        'source' => 'TaxonomyTermSource',
        'localization' => 'mixed',
        'customer' => 'DynamicReference',
        'project' => 'DynamicReference',
        'terms' => 'Terms',
        'classificationFormula' => 'Formula',
        'id' => 'string',
        'createdAt' => 'float',
        'updatedAt' => 'float',
        'deletedAt' => 'float',
    ];

    /**
     * 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 = [
        'accessScope' => null,
        'accessKeyIds' => null,
        'taxonomy' => null,
        'status' => null,
        'version' => null,
        'previousStatus' => null,
        'revisionArchivedAt' => null,
        'origin' => null,
        'key' => null,
        'name' => null,
        'description' => null,
        'classificationPrompt' => null,
        'aliases' => null,
        'collectionTerms' => null,
        'timeFrame' => null,
        'priority' => null,
        'thirdParty' => null,
        'source' => null,
        'localization' => null,
        'customer' => null,
        'project' => null,
        'terms' => null,
        'classificationFormula' => null,
        'id' => null,
        'createdAt' => null,
        'updatedAt' => null,
        'deletedAt' => null,
    ];

    /**
     * Array of nullable properties. Used for (de)serialization.
     *
     * @var bool[]
     */
    protected static array $openAPINullables = [
        'accessScope' => false,
        'accessKeyIds' => false,
        'taxonomy' => false,
        'status' => false,
        'version' => false,
        'previousStatus' => true,
        'revisionArchivedAt' => true,
        'origin' => false,
        'key' => false,
        'name' => false,
        'description' => true,
        'classificationPrompt' => true,
        'aliases' => true,
        'collectionTerms' => true,
        'timeFrame' => true,
        'priority' => true,
        'thirdParty' => true,
        'source' => true,
        'localization' => true,
        'customer' => true,
        'project' => true,
        'terms' => true,
        'classificationFormula' => true,
        'id' => false,
        'createdAt' => false,
        'updatedAt' => false,
        'deletedAt' => 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 = [
        'accessScope' => 'accessScope',
        'accessKeyIds' => 'accessKeyIds',
        'taxonomy' => 'taxonomy',
        'status' => 'status',
        'version' => 'version',
        'previousStatus' => 'previousStatus',
        'revisionArchivedAt' => 'revisionArchivedAt',
        'origin' => 'origin',
        'key' => 'key',
        'name' => 'name',
        'description' => 'description',
        'classificationPrompt' => 'classificationPrompt',
        'aliases' => 'aliases',
        'collectionTerms' => 'collectionTerms',
        'timeFrame' => 'timeFrame',
        'priority' => 'priority',
        'thirdParty' => 'thirdParty',
        'source' => 'source',
        'localization' => 'localization',
        'customer' => 'customer',
        'project' => 'project',
        'terms' => 'terms',
        'classificationFormula' => 'classificationFormula',
        'id' => 'id',
        'createdAt' => 'createdAt',
        'updatedAt' => 'updatedAt',
        'deletedAt' => 'deletedAt',
    ];

    /**
     * Array of attributes to setter functions (for deserialization of responses).
     *
     * @var string[]
     */
    protected static $setters = [
        'accessScope' => 'setAccessScope',
        'accessKeyIds' => 'setAccessKeyIds',
        'taxonomy' => 'setTaxonomy',
        'status' => 'setStatus',
        'version' => 'setVersion',
        'previousStatus' => 'setPreviousStatus',
        'revisionArchivedAt' => 'setRevisionArchivedAt',
        'origin' => 'setOrigin',
        'key' => 'setKey',
        'name' => 'setName',
        'description' => 'setDescription',
        'classificationPrompt' => 'setClassificationPrompt',
        'aliases' => 'setAliases',
        'collectionTerms' => 'setCollectionTerms',
        'timeFrame' => 'setTimeFrame',
        'priority' => 'setPriority',
        'thirdParty' => 'setThirdParty',
        'source' => 'setSource',
        'localization' => 'setLocalization',
        'customer' => 'setCustomer',
        'project' => 'setProject',
        'terms' => 'setTerms',
        'classificationFormula' => 'setClassificationFormula',
        'id' => 'setId',
        'createdAt' => 'setCreatedAt',
        'updatedAt' => 'setUpdatedAt',
        'deletedAt' => 'setDeletedAt',
    ];

    /**
     * Array of attributes to getter functions (for serialization of requests).
     *
     * @var string[]
     */
    protected static $getters = [
        'accessScope' => 'getAccessScope',
        'accessKeyIds' => 'getAccessKeyIds',
        'taxonomy' => 'getTaxonomy',
        'status' => 'getStatus',
        'version' => 'getVersion',
        'previousStatus' => 'getPreviousStatus',
        'revisionArchivedAt' => 'getRevisionArchivedAt',
        'origin' => 'getOrigin',
        'key' => 'getKey',
        'name' => 'getName',
        'description' => 'getDescription',
        'classificationPrompt' => 'getClassificationPrompt',
        'aliases' => 'getAliases',
        'collectionTerms' => 'getCollectionTerms',
        'timeFrame' => 'getTimeFrame',
        'priority' => 'getPriority',
        'thirdParty' => 'getThirdParty',
        'source' => 'getSource',
        'localization' => 'getLocalization',
        'customer' => 'getCustomer',
        'project' => 'getProject',
        'terms' => 'getTerms',
        'classificationFormula' => 'getClassificationFormula',
        'id' => 'getId',
        'createdAt' => 'getCreatedAt',
        'updatedAt' => 'getUpdatedAt',
        'deletedAt' => 'getDeletedAt',
    ];

    /**
     * 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('accessScope', $data ?? [], null);
        $this->setIfExists('accessKeyIds', $data ?? [], null);
        $this->setIfExists('taxonomy', $data ?? [], null);
        $this->setIfExists('status', $data ?? [], null);
        $this->setIfExists('version', $data ?? [], null);
        $this->setIfExists('previousStatus', $data ?? [], null);
        $this->setIfExists('revisionArchivedAt', $data ?? [], null);
        $this->setIfExists('origin', $data ?? [], null);
        $this->setIfExists('key', $data ?? [], null);
        $this->setIfExists('name', $data ?? [], null);
        $this->setIfExists('description', $data ?? [], null);
        $this->setIfExists('classificationPrompt', $data ?? [], null);
        $this->setIfExists('aliases', $data ?? [], null);
        $this->setIfExists('collectionTerms', $data ?? [], null);
        $this->setIfExists('timeFrame', $data ?? [], null);
        $this->setIfExists('priority', $data ?? [], null);
        $this->setIfExists('thirdParty', $data ?? [], null);
        $this->setIfExists('source', $data ?? [], null);
        $this->setIfExists('localization', $data ?? [], null);
        $this->setIfExists('customer', $data ?? [], null);
        $this->setIfExists('project', $data ?? [], null);
        $this->setIfExists('terms', $data ?? [], null);
        $this->setIfExists('classificationFormula', $data ?? [], null);
        $this->setIfExists('id', $data ?? [], null);
        $this->setIfExists('createdAt', $data ?? [], null);
        $this->setIfExists('updatedAt', $data ?? [], null);
        $this->setIfExists('deletedAt', $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['accessScope']) {
            $invalidProperties[] = "'accessScope' can't be null";
        }
        if (null === $this->container['accessKeyIds']) {
            $invalidProperties[] = "'accessKeyIds' can't be null";
        }
        if (null === $this->container['taxonomy']) {
            $invalidProperties[] = "'taxonomy' can't be null";
        }
        if (null === $this->container['status']) {
            $invalidProperties[] = "'status' can't be null";
        }
        if (null === $this->container['version']) {
            $invalidProperties[] = "'version' can't be null";
        }
        if (null === $this->container['origin']) {
            $invalidProperties[] = "'origin' can't be null";
        }
        if (null === $this->container['key']) {
            $invalidProperties[] = "'key' 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 accessScope.
     *
     * @return AccessScope
     */
    public function getAccessScope()
    {
        return $this->container['accessScope'];
    }

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

        return $this;
    }

    /**
     * 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 taxonomy.
     *
     * @return TaxonomyTermEntityTaxonomy
     */
    public function getTaxonomy()
    {
        return $this->container['taxonomy'];
    }

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

        return $this;
    }

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

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

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

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

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

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

        return $this;
    }

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

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

        return $this;
    }

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

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

        return $this;
    }

    /**
     * Gets collectionTerms.
     *
     * @return null|DynamicRevisionReference[]
     */
    public function getCollectionTerms()
    {
        return $this->container['collectionTerms'];
    }

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

        return $this;
    }

    /**
     * Gets timeFrame.
     *
     * @return null|TimeFrame
     */
    public function getTimeFrame()
    {
        return $this->container['timeFrame'];
    }

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

        return $this;
    }

    /**
     * Gets priority.
     *
     * @return null|TaxonomyTermPriority
     */
    public function getPriority()
    {
        return $this->container['priority'];
    }

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

        return $this;
    }

    /**
     * Gets thirdParty.
     *
     * @return null|TaxonomyTermThirdParty
     */
    public function getThirdParty()
    {
        return $this->container['thirdParty'];
    }

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

        return $this;
    }

    /**
     * Gets source.
     *
     * @return null|TaxonomyTermSource
     */
    public function getSource()
    {
        return $this->container['source'];
    }

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

        return $this;
    }

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

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

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

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

        return $this;
    }

    /**
     * Gets classificationFormula.
     *
     * @return null|Formula
     */
    public function getClassificationFormula()
    {
        return $this->container['classificationFormula'];
    }

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

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

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