<?php

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

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

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

    /**
     * Array of property to type mappings. Used for (de)serialization.
     *
     * @var string[]
     */
    protected static $openAPITypes = [
        'role' => 'string',
        'context' => 'string',
        'task' => 'string',
        'input' => 'string',
        'output' => 'string',
        'decisions' => 'string',
        'guardrails' => 'string',
        'uncertainty' => 'string',
        'explainability' => 'string',
        'tone' => 'string',
        'developer' => 'string',
    ];

    /**
     * Array of property to format mappings. Used for (de)serialization.
     *
     * @var string[]
     *
     * @phpstan-var array<string, string|null>
     *
     * @psalm-var array<string, string|null>
     */
    protected static $openAPIFormats = [
        'role' => null,
        'context' => null,
        'task' => null,
        'input' => null,
        'output' => null,
        'decisions' => null,
        'guardrails' => null,
        'uncertainty' => null,
        'explainability' => null,
        'tone' => null,
        'developer' => null,
    ];

    /**
     * Array of nullable properties. Used for (de)serialization.
     *
     * @var bool[]
     */
    protected static array $openAPINullables = [
        'role' => true,
        'context' => true,
        'task' => true,
        'input' => true,
        'output' => true,
        'decisions' => true,
        'guardrails' => true,
        'uncertainty' => true,
        'explainability' => true,
        'tone' => true,
        'developer' => 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 = [
        'role' => 'role',
        'context' => 'context',
        'task' => 'task',
        'input' => 'input',
        'output' => 'output',
        'decisions' => 'decisions',
        'guardrails' => 'guardrails',
        'uncertainty' => 'uncertainty',
        'explainability' => 'explainability',
        'tone' => 'tone',
        'developer' => 'developer',
    ];

    /**
     * Array of attributes to setter functions (for deserialization of responses).
     *
     * @var string[]
     */
    protected static $setters = [
        'role' => 'setRole',
        'context' => 'setContext',
        'task' => 'setTask',
        'input' => 'setInput',
        'output' => 'setOutput',
        'decisions' => 'setDecisions',
        'guardrails' => 'setGuardrails',
        'uncertainty' => 'setUncertainty',
        'explainability' => 'setExplainability',
        'tone' => 'setTone',
        'developer' => 'setDeveloper',
    ];

    /**
     * Array of attributes to getter functions (for serialization of requests).
     *
     * @var string[]
     */
    protected static $getters = [
        'role' => 'getRole',
        'context' => 'getContext',
        'task' => 'getTask',
        'input' => 'getInput',
        'output' => 'getOutput',
        'decisions' => 'getDecisions',
        'guardrails' => 'getGuardrails',
        'uncertainty' => 'getUncertainty',
        'explainability' => 'getExplainability',
        'tone' => 'getTone',
        'developer' => 'getDeveloper',
    ];

    /**
     * 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('role', $data ?? [], null);
        $this->setIfExists('context', $data ?? [], null);
        $this->setIfExists('task', $data ?? [], null);
        $this->setIfExists('input', $data ?? [], null);
        $this->setIfExists('output', $data ?? [], null);
        $this->setIfExists('decisions', $data ?? [], null);
        $this->setIfExists('guardrails', $data ?? [], null);
        $this->setIfExists('uncertainty', $data ?? [], null);
        $this->setIfExists('explainability', $data ?? [], null);
        $this->setIfExists('tone', $data ?? [], null);
        $this->setIfExists('developer', $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()
    {
        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 role.
     *
     * @return null|string
     */
    public function getRole()
    {
        return $this->container['role'];
    }

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

        return $this;
    }

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

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

        return $this;
    }

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

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

        return $this;
    }

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

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

        return $this;
    }

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

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

        return $this;
    }

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

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

        return $this;
    }

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

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

        return $this;
    }

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

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

        return $this;
    }

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

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

        return $this;
    }

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

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

        return $this;
    }

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

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

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