<?php

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

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

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

    /**
     * Array of property to type mappings. Used for (de)serialization.
     *
     * @var string[]
     */
    protected static $openAPITypes = [
        'status' => 'MonitoringPromptStatus',
        'name' => 'string',
        'type' => 'MonitoringPromptType',
        'templatePrompt' => 'mixed',
        'promptText' => 'string',
        'promptLocale' => '\EdgeBox\SyncCore\V2\Raw\Model\TermAssignmentTerm',
        'templateFacet' => 'TaxonomyFacet',
        'templateTerms' => '\EdgeBox\SyncCore\V2\Raw\Model\DynamicRevisionReference[]',
        'engines' => '\EdgeBox\SyncCore\V2\Raw\Model\DynamicRevisionReference[]',
        'countryLocales' => '\EdgeBox\SyncCore\V2\Raw\Model\MonitoringPromptCountryLocale[]',
        'frequencyHours' => 'float',
        'staticTerms' => '\EdgeBox\SyncCore\V2\Raw\Model\DynamicRevisionReference[]',
        'terms' => '\EdgeBox\SyncCore\V2\Raw\Model\TermAssignment[]',
        'targetTerms' => '\EdgeBox\SyncCore\V2\Raw\Model\TermAssignment[]',
        'project' => '\EdgeBox\SyncCore\V2\Raw\Model\RuntimeRemoteEntityDependencyWithDependenciesEntity',
    ];

    /**
     * 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 = [
        'status' => null,
        'name' => null,
        'type' => null,
        'templatePrompt' => null,
        'promptText' => null,
        'promptLocale' => null,
        'templateFacet' => null,
        'templateTerms' => null,
        'engines' => null,
        'countryLocales' => null,
        'frequencyHours' => null,
        'staticTerms' => null,
        'terms' => null,
        'targetTerms' => null,
        'project' => null,
    ];

    /**
     * Array of nullable properties. Used for (de)serialization.
     *
     * @var bool[]
     */
    protected static array $openAPINullables = [
        'status' => true,
        'name' => false,
        'type' => false,
        'templatePrompt' => true,
        'promptText' => false,
        'promptLocale' => false,
        'templateFacet' => true,
        'templateTerms' => true,
        'engines' => false,
        'countryLocales' => false,
        'frequencyHours' => false,
        'staticTerms' => true,
        'terms' => true,
        'targetTerms' => true,
        'project' => 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 = [
        'status' => 'status',
        'name' => 'name',
        'type' => 'type',
        'templatePrompt' => 'templatePrompt',
        'promptText' => 'promptText',
        'promptLocale' => 'promptLocale',
        'templateFacet' => 'templateFacet',
        'templateTerms' => 'templateTerms',
        'engines' => 'engines',
        'countryLocales' => 'countryLocales',
        'frequencyHours' => 'frequencyHours',
        'staticTerms' => 'staticTerms',
        'terms' => 'terms',
        'targetTerms' => 'targetTerms',
        'project' => 'project',
    ];

    /**
     * Array of attributes to setter functions (for deserialization of responses).
     *
     * @var string[]
     */
    protected static $setters = [
        'status' => 'setStatus',
        'name' => 'setName',
        'type' => 'setType',
        'templatePrompt' => 'setTemplatePrompt',
        'promptText' => 'setPromptText',
        'promptLocale' => 'setPromptLocale',
        'templateFacet' => 'setTemplateFacet',
        'templateTerms' => 'setTemplateTerms',
        'engines' => 'setEngines',
        'countryLocales' => 'setCountryLocales',
        'frequencyHours' => 'setFrequencyHours',
        'staticTerms' => 'setStaticTerms',
        'terms' => 'setTerms',
        'targetTerms' => 'setTargetTerms',
        'project' => 'setProject',
    ];

    /**
     * Array of attributes to getter functions (for serialization of requests).
     *
     * @var string[]
     */
    protected static $getters = [
        'status' => 'getStatus',
        'name' => 'getName',
        'type' => 'getType',
        'templatePrompt' => 'getTemplatePrompt',
        'promptText' => 'getPromptText',
        'promptLocale' => 'getPromptLocale',
        'templateFacet' => 'getTemplateFacet',
        'templateTerms' => 'getTemplateTerms',
        'engines' => 'getEngines',
        'countryLocales' => 'getCountryLocales',
        'frequencyHours' => 'getFrequencyHours',
        'staticTerms' => 'getStaticTerms',
        'terms' => 'getTerms',
        'targetTerms' => 'getTargetTerms',
        'project' => 'getProject',
    ];

    /**
     * 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('status', $data ?? [], null);
        $this->setIfExists('name', $data ?? [], null);
        $this->setIfExists('type', $data ?? [], null);
        $this->setIfExists('templatePrompt', $data ?? [], null);
        $this->setIfExists('promptText', $data ?? [], null);
        $this->setIfExists('promptLocale', $data ?? [], null);
        $this->setIfExists('templateFacet', $data ?? [], null);
        $this->setIfExists('templateTerms', $data ?? [], null);
        $this->setIfExists('engines', $data ?? [], null);
        $this->setIfExists('countryLocales', $data ?? [], null);
        $this->setIfExists('frequencyHours', $data ?? [], null);
        $this->setIfExists('staticTerms', $data ?? [], null);
        $this->setIfExists('terms', $data ?? [], null);
        $this->setIfExists('targetTerms', $data ?? [], null);
        $this->setIfExists('project', $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['name']) {
            $invalidProperties[] = "'name' can't be null";
        }
        if (null === $this->container['type']) {
            $invalidProperties[] = "'type' can't be null";
        }
        if (null === $this->container['promptText']) {
            $invalidProperties[] = "'promptText' can't be null";
        }
        if (null === $this->container['promptLocale']) {
            $invalidProperties[] = "'promptLocale' can't be null";
        }
        if (null === $this->container['engines']) {
            $invalidProperties[] = "'engines' can't be null";
        }
        if (null === $this->container['countryLocales']) {
            $invalidProperties[] = "'countryLocales' can't be null";
        }
        if (null === $this->container['frequencyHours']) {
            $invalidProperties[] = "'frequencyHours' can't be null";
        }
        if (null === $this->container['project']) {
            $invalidProperties[] = "'project' 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 status.
     *
     * @return null|MonitoringPromptStatus
     */
    public function getStatus()
    {
        return $this->container['status'];
    }

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

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

    /**
     * Sets type.
     *
     * @param MonitoringPromptType $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 templatePrompt.
     *
     * @return null|mixed
     */
    public function getTemplatePrompt()
    {
        return $this->container['templatePrompt'];
    }

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

        return $this;
    }

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

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

        return $this;
    }

    /**
     * Gets promptLocale.
     *
     * @return TermAssignmentTerm
     */
    public function getPromptLocale()
    {
        return $this->container['promptLocale'];
    }

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

        return $this;
    }

    /**
     * Gets templateFacet.
     *
     * @return null|TaxonomyFacet
     */
    public function getTemplateFacet()
    {
        return $this->container['templateFacet'];
    }

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

        return $this;
    }

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

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

        return $this;
    }

    /**
     * Gets engines.
     *
     * @return DynamicRevisionReference[]
     */
    public function getEngines()
    {
        return $this->container['engines'];
    }

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

        return $this;
    }

    /**
     * Gets countryLocales.
     *
     * @return MonitoringPromptCountryLocale[]
     */
    public function getCountryLocales()
    {
        return $this->container['countryLocales'];
    }

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

        return $this;
    }

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

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

        return $this;
    }

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

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

        return $this;
    }

    /**
     * Gets terms.
     *
     * @return null|TermAssignment[]
     */
    public function getTerms()
    {
        return $this->container['terms'];
    }

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

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

        return $this;
    }

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

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

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