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

/**
 * ToolInvocationV4 Class Doc Comment.
 *
 * @category Class
 *
 * @description Model for tool invocation in a Message.
 */
class ToolInvocationV4 extends AbstractModel implements ModelInterface, \ArrayAccess, \JsonSerializable
{
    /**
     * Array of property to type mappings. Used for (de)serialization.
     *
     * @var string[]
     */
    protected static $modelTypes = [
        'toolCallId' => 'string',
        'toolName' => 'string',
        'args' => 'array<string,mixed>',
        'result' => 'array<string,mixed>',
        'step' => 'int',
        'state' => 'string',
        'providerOptions' => 'array<string,mixed>',
        'requiresApproval' => 'bool',
        'description' => 'string',
        'argsHash' => 'string',
    ];

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

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

    /**
     * Array of attributes to setter functions (for deserialization of responses).
     *
     * @var string[]
     */
    protected static $setters = [
        'toolCallId' => 'setToolCallId',
        'toolName' => 'setToolName',
        'args' => 'setArgs',
        'result' => 'setResult',
        'step' => 'setStep',
        'state' => 'setState',
        'providerOptions' => 'setProviderOptions',
        'requiresApproval' => 'setRequiresApproval',
        'description' => 'setDescription',
        'argsHash' => 'setArgsHash',
    ];

    /**
     * Array of attributes to getter functions (for serialization of requests).
     *
     * @var string[]
     */
    protected static $getters = [
        'toolCallId' => 'getToolCallId',
        'toolName' => 'getToolName',
        'args' => 'getArgs',
        'result' => 'getResult',
        'step' => 'getStep',
        'state' => 'getState',
        'providerOptions' => 'getProviderOptions',
        'requiresApproval' => 'getRequiresApproval',
        'description' => 'getDescription',
        'argsHash' => 'getArgsHash',
    ];

    /**
     * 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['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['result'])) {
            $this->container['result'] = $data['result'];
        }
        if (isset($data['step'])) {
            $this->container['step'] = $data['step'];
        }
        if (isset($data['state'])) {
            $this->container['state'] = $data['state'];
        }
        if (isset($data['providerOptions'])) {
            $this->container['providerOptions'] = $data['providerOptions'];
        }
        if (isset($data['requiresApproval'])) {
            $this->container['requiresApproval'] = $data['requiresApproval'];
        }
        if (isset($data['description'])) {
            $this->container['description'] = $data['description'];
        }
        if (isset($data['argsHash'])) {
            $this->container['argsHash'] = $data['argsHash'];
        }
    }

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

        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 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 null|array<string,mixed>
     */
    public function getArgs()
    {
        return $this->container['args'] ?? null;
    }

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

        return $this;
    }

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

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

        return $this;
    }

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

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

        return $this;
    }

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

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

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

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