<?php

// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.

namespace Algolia\AlgoliaSearch\Model\AgentStudio;

use Algolia\AlgoliaSearch\Model\AbstractModel;
use Algolia\AlgoliaSearch\Model\ModelInterface;

/**
 * MessagePart Class Doc Comment.
 *
 * @category Class
 */
class MessagePart extends AbstractModel implements ModelInterface, \ArrayAccess, \JsonSerializable
{
    /**
     * Array of property to type mappings. Used for (de)serialization.
     *
     * @var string[]
     */
    protected static $modelTypes = [
        'type' => 'string',
        'text' => 'string',
        'toolCallId' => 'string',
        'toolName' => 'string',
        'args' => 'mixed',
        'requiresApproval' => 'bool',
        'providerOptions' => 'array<string,mixed>',
        'output' => '\Algolia\AlgoliaSearch\Model\AgentStudio\ToolResultOutput',
        'description' => 'string',
        'argsHash' => 'string',
        'appId' => 'string',
    ];

    /**
     * Array of property to format mappings. Used for (de)serialization.
     *
     * @var string[]
     */
    protected static $modelFormats = [
        'type' => null,
        'text' => null,
        'toolCallId' => null,
        'toolName' => null,
        'args' => null,
        'requiresApproval' => null,
        'providerOptions' => null,
        'output' => null,
        'description' => null,
        'argsHash' => null,
        'appId' => null,
    ];

    /**
     * Array of attributes where the key is the local name,
     * and the value is the original name.
     *
     * @var string[]
     */
    protected static $attributeMap = [
        'type' => 'type',
        'text' => 'text',
        'toolCallId' => 'toolCallId',
        'toolName' => 'toolName',
        'args' => 'args',
        'requiresApproval' => 'requiresApproval',
        'providerOptions' => 'providerOptions',
        'output' => 'output',
        'description' => 'description',
        'argsHash' => 'argsHash',
        'appId' => 'appId',
    ];

    /**
     * Array of attributes to setter functions (for deserialization of responses).
     *
     * @var string[]
     */
    protected static $setters = [
        'type' => 'setType',
        'text' => 'setText',
        'toolCallId' => 'setToolCallId',
        'toolName' => 'setToolName',
        'args' => 'setArgs',
        'requiresApproval' => 'setRequiresApproval',
        'providerOptions' => 'setProviderOptions',
        'output' => 'setOutput',
        'description' => 'setDescription',
        'argsHash' => 'setArgsHash',
        'appId' => 'setAppId',
    ];

    /**
     * Array of attributes to getter functions (for serialization of requests).
     *
     * @var string[]
     */
    protected static $getters = [
        'type' => 'getType',
        'text' => 'getText',
        'toolCallId' => 'getToolCallId',
        'toolName' => 'getToolName',
        'args' => 'getArgs',
        'requiresApproval' => 'getRequiresApproval',
        'providerOptions' => 'getProviderOptions',
        'output' => 'getOutput',
        'description' => 'getDescription',
        'argsHash' => 'getArgsHash',
        'appId' => 'getAppId',
    ];

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

    /**
     * Constructor.
     *
     * @param mixed[] $data Associated array of property values
     */
    public function __construct(?array $data = null)
    {
        if (isset($data['type'])) {
            $this->container['type'] = $data['type'];
        }
        if (isset($data['text'])) {
            $this->container['text'] = $data['text'];
        }
        if (isset($data['toolCallId'])) {
            $this->container['toolCallId'] = $data['toolCallId'];
        }
        if (isset($data['toolName'])) {
            $this->container['toolName'] = $data['toolName'];
        }
        if (isset($data['args'])) {
            $this->container['args'] = $data['args'];
        }
        if (isset($data['requiresApproval'])) {
            $this->container['requiresApproval'] = $data['requiresApproval'];
        }
        if (isset($data['providerOptions'])) {
            $this->container['providerOptions'] = $data['providerOptions'];
        }
        if (isset($data['output'])) {
            $this->container['output'] = $data['output'];
        }
        if (isset($data['description'])) {
            $this->container['description'] = $data['description'];
        }
        if (isset($data['argsHash'])) {
            $this->container['argsHash'] = $data['argsHash'];
        }
        if (isset($data['appId'])) {
            $this->container['appId'] = $data['appId'];
        }
    }

    /**
     * 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 property to type mappings. Used for (de)serialization.
     *
     * @return array
     */
    public static function modelTypes()
    {
        return self::$modelTypes;
    }

    /**
     * Array of property to format mappings. Used for (de)serialization.
     *
     * @return array
     */
    public static function modelFormats()
    {
        return self::$modelFormats;
    }

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

    /**
     * Show all the invalid properties with reasons.
     *
     * @return array invalid properties with reasons
     */
    public function listInvalidProperties()
    {
        $invalidProperties = [];

        if (!isset($this->container['type']) || null === $this->container['type']) {
            $invalidProperties[] = "'type' can't be null";
        }
        if (!isset($this->container['text']) || null === $this->container['text']) {
            $invalidProperties[] = "'text' can't be null";
        }
        if (!isset($this->container['toolCallId']) || null === $this->container['toolCallId']) {
            $invalidProperties[] = "'toolCallId' can't be null";
        }
        if (!isset($this->container['toolName']) || null === $this->container['toolName']) {
            $invalidProperties[] = "'toolName' can't be null";
        }
        if (!isset($this->container['args']) || null === $this->container['args']) {
            $invalidProperties[] = "'args' can't be null";
        }
        if (!isset($this->container['output']) || null === $this->container['output']) {
            $invalidProperties[] = "'output' 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 type.
     *
     * @return string
     */
    public function getType()
    {
        return $this->container['type'] ?? null;
    }

    /**
     * Sets type.
     *
     * @param string $type type
     *
     * @return self
     */
    public function setType($type)
    {
        $this->container['type'] = $type;

        return $this;
    }

    /**
     * Gets text.
     *
     * @return string
     */
    public function getText()
    {
        return $this->container['text'] ?? null;
    }

    /**
     * Sets text.
     *
     * @param string $text text
     *
     * @return self
     */
    public function setText($text)
    {
        $this->container['text'] = $text;

        return $this;
    }

    /**
     * Gets toolCallId.
     *
     * @return string
     */
    public function getToolCallId()
    {
        return $this->container['toolCallId'] ?? null;
    }

    /**
     * Sets toolCallId.
     *
     * @param string $toolCallId toolCallId
     *
     * @return self
     */
    public function setToolCallId($toolCallId)
    {
        $this->container['toolCallId'] = $toolCallId;

        return $this;
    }

    /**
     * Gets toolName.
     *
     * @return string
     */
    public function getToolName()
    {
        return $this->container['toolName'] ?? null;
    }

    /**
     * Sets toolName.
     *
     * @param string $toolName toolName
     *
     * @return self
     */
    public function setToolName($toolName)
    {
        $this->container['toolName'] = $toolName;

        return $this;
    }

    /**
     * Gets args.
     *
     * @return mixed
     */
    public function getArgs()
    {
        return $this->container['args'] ?? null;
    }

    /**
     * Sets args.
     *
     * @param mixed $args args
     *
     * @return self
     */
    public function setArgs($args)
    {
        $this->container['args'] = $args;

        return $this;
    }

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

    /**
     * Sets requiresApproval.
     *
     * @param null|bool $requiresApproval requiresApproval
     *
     * @return self
     */
    public function setRequiresApproval($requiresApproval)
    {
        $this->container['requiresApproval'] = $requiresApproval;

        return $this;
    }

    /**
     * Gets providerOptions.
     *
     * @return null|array<string,mixed>
     */
    public function getProviderOptions()
    {
        return $this->container['providerOptions'] ?? null;
    }

    /**
     * Sets providerOptions.
     *
     * @param null|array<string,mixed> $providerOptions providerOptions
     *
     * @return self
     */
    public function setProviderOptions($providerOptions)
    {
        $this->container['providerOptions'] = $providerOptions;

        return $this;
    }

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

    /**
     * Sets output.
     *
     * @param ToolResultOutput $output output
     *
     * @return self
     */
    public function setOutput($output)
    {
        $this->container['output'] = $output;

        return $this;
    }

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

    /**
     * Sets description.
     *
     * @param null|string $description description
     *
     * @return self
     */
    public function setDescription($description)
    {
        $this->container['description'] = $description;

        return $this;
    }

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

    /**
     * Sets argsHash.
     *
     * @param null|string $argsHash argsHash
     *
     * @return self
     */
    public function setArgsHash($argsHash)
    {
        $this->container['argsHash'] = $argsHash;

        return $this;
    }

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

    /**
     * Sets appId.
     *
     * @param null|string $appId appId
     *
     * @return self
     */
    public function setAppId($appId)
    {
        $this->container['appId'] = $appId;

        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
     */
    public function offsetGet($offset): mixed
    {
        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]);
    }
}
