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

/**
 * ToolConfigInput Class Doc Comment.
 *
 * @category Class
 */
class ToolConfigInput extends AbstractModel implements ModelInterface, \ArrayAccess, \JsonSerializable
{
    /**
     * Array of property to type mappings. Used for (de)serialization.
     *
     * @var string[]
     */
    protected static $modelTypes = [
        'name' => 'string',
        'type' => 'string',
        'description' => 'string',
        'inputSchema' => '\Algolia\AlgoliaSearch\Model\AgentStudio\ClientToolsArgsSchema',
        'indices' => '\Algolia\AlgoliaSearch\Model\AgentStudio\AlgoliaSearchToolIndexConfig[]',
        'allowedConfigs' => '\Algolia\AlgoliaSearch\Model\AgentStudio\AlgoliaRecommendToolIndexConfig[]',
        'predefinedRecommendParameters' => 'array<string,mixed>',
        'minGroups' => 'int',
        'maxGroups' => 'int',
        'minResultsPerGroup' => 'int',
        'maxResultsPerGroup' => 'int',
        'url' => 'string',
        'transport' => 'string',
        'headers' => 'array<string,string>',
        'id' => 'string',
        'allowedTools' => 'array<string,\Algolia\AlgoliaSearch\Model\AgentStudio\ToolConfig>',
    ];

    /**
     * Array of property to format mappings. Used for (de)serialization.
     *
     * @var string[]
     */
    protected static $modelFormats = [
        'name' => null,
        'type' => null,
        'description' => null,
        'inputSchema' => null,
        'indices' => null,
        'allowedConfigs' => null,
        'predefinedRecommendParameters' => null,
        'minGroups' => null,
        'maxGroups' => null,
        'minResultsPerGroup' => null,
        'maxResultsPerGroup' => null,
        'url' => null,
        'transport' => null,
        'headers' => null,
        'id' => null,
        'allowedTools' => null,
    ];

    /**
     * Array of attributes where the key is the local name,
     * and the value is the original name.
     *
     * @var string[]
     */
    protected static $attributeMap = [
        'name' => 'name',
        'type' => 'type',
        'description' => 'description',
        'inputSchema' => 'inputSchema',
        'indices' => 'indices',
        'allowedConfigs' => 'allowedConfigs',
        'predefinedRecommendParameters' => 'predefinedRecommendParameters',
        'minGroups' => 'minGroups',
        'maxGroups' => 'maxGroups',
        'minResultsPerGroup' => 'minResultsPerGroup',
        'maxResultsPerGroup' => 'maxResultsPerGroup',
        'url' => 'url',
        'transport' => 'transport',
        'headers' => 'headers',
        'id' => 'id',
        'allowedTools' => 'allowedTools',
    ];

    /**
     * Array of attributes to setter functions (for deserialization of responses).
     *
     * @var string[]
     */
    protected static $setters = [
        'name' => 'setName',
        'type' => 'setType',
        'description' => 'setDescription',
        'inputSchema' => 'setInputSchema',
        'indices' => 'setIndices',
        'allowedConfigs' => 'setAllowedConfigs',
        'predefinedRecommendParameters' => 'setPredefinedRecommendParameters',
        'minGroups' => 'setMinGroups',
        'maxGroups' => 'setMaxGroups',
        'minResultsPerGroup' => 'setMinResultsPerGroup',
        'maxResultsPerGroup' => 'setMaxResultsPerGroup',
        'url' => 'setUrl',
        'transport' => 'setTransport',
        'headers' => 'setHeaders',
        'id' => 'setId',
        'allowedTools' => 'setAllowedTools',
    ];

    /**
     * Array of attributes to getter functions (for serialization of requests).
     *
     * @var string[]
     */
    protected static $getters = [
        'name' => 'getName',
        'type' => 'getType',
        'description' => 'getDescription',
        'inputSchema' => 'getInputSchema',
        'indices' => 'getIndices',
        'allowedConfigs' => 'getAllowedConfigs',
        'predefinedRecommendParameters' => 'getPredefinedRecommendParameters',
        'minGroups' => 'getMinGroups',
        'maxGroups' => 'getMaxGroups',
        'minResultsPerGroup' => 'getMinResultsPerGroup',
        'maxResultsPerGroup' => 'getMaxResultsPerGroup',
        'url' => 'getUrl',
        'transport' => 'getTransport',
        'headers' => 'getHeaders',
        'id' => 'getId',
        'allowedTools' => 'getAllowedTools',
    ];

    /**
     * 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['name'])) {
            $this->container['name'] = $data['name'];
        }
        if (isset($data['type'])) {
            $this->container['type'] = $data['type'];
        }
        if (isset($data['description'])) {
            $this->container['description'] = $data['description'];
        }
        if (isset($data['inputSchema'])) {
            $this->container['inputSchema'] = $data['inputSchema'];
        }
        if (isset($data['indices'])) {
            $this->container['indices'] = $data['indices'];
        }
        if (isset($data['allowedConfigs'])) {
            $this->container['allowedConfigs'] = $data['allowedConfigs'];
        }
        if (isset($data['predefinedRecommendParameters'])) {
            $this->container['predefinedRecommendParameters'] = $data['predefinedRecommendParameters'];
        }
        if (isset($data['minGroups'])) {
            $this->container['minGroups'] = $data['minGroups'];
        }
        if (isset($data['maxGroups'])) {
            $this->container['maxGroups'] = $data['maxGroups'];
        }
        if (isset($data['minResultsPerGroup'])) {
            $this->container['minResultsPerGroup'] = $data['minResultsPerGroup'];
        }
        if (isset($data['maxResultsPerGroup'])) {
            $this->container['maxResultsPerGroup'] = $data['maxResultsPerGroup'];
        }
        if (isset($data['url'])) {
            $this->container['url'] = $data['url'];
        }
        if (isset($data['transport'])) {
            $this->container['transport'] = $data['transport'];
        }
        if (isset($data['headers'])) {
            $this->container['headers'] = $data['headers'];
        }
        if (isset($data['id'])) {
            $this->container['id'] = $data['id'];
        }
        if (isset($data['allowedTools'])) {
            $this->container['allowedTools'] = $data['allowedTools'];
        }
    }

    /**
     * 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['name']) || null === $this->container['name']) {
            $invalidProperties[] = "'name' can't be null";
        }
        if (!isset($this->container['type']) || null === $this->container['type']) {
            $invalidProperties[] = "'type' can't be null";
        }
        if (!isset($this->container['description']) || null === $this->container['description']) {
            $invalidProperties[] = "'description' can't be null";
        }
        if (!isset($this->container['inputSchema']) || null === $this->container['inputSchema']) {
            $invalidProperties[] = "'inputSchema' can't be null";
        }
        if (!isset($this->container['indices']) || null === $this->container['indices']) {
            $invalidProperties[] = "'indices' can't be null";
        }
        if (!isset($this->container['url']) || null === $this->container['url']) {
            $invalidProperties[] = "'url' can't be null";
        }
        if (!isset($this->container['headers']) || null === $this->container['headers']) {
            $invalidProperties[] = "'headers' 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 name.
     *
     * @return string
     */
    public function getName()
    {
        return $this->container['name'] ?? null;
    }

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

        return $this;
    }

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

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

        return $this;
    }

    /**
     * Gets inputSchema.
     *
     * @return ClientToolsArgsSchema
     */
    public function getInputSchema()
    {
        return $this->container['inputSchema'] ?? null;
    }

    /**
     * Sets inputSchema.
     *
     * @param ClientToolsArgsSchema $inputSchema inputSchema
     *
     * @return self
     */
    public function setInputSchema($inputSchema)
    {
        $this->container['inputSchema'] = $inputSchema;

        return $this;
    }

    /**
     * Gets indices.
     *
     * @return AlgoliaSearchToolIndexConfig[]
     */
    public function getIndices()
    {
        return $this->container['indices'] ?? null;
    }

    /**
     * Sets indices.
     *
     * @param AlgoliaSearchToolIndexConfig[] $indices indices
     *
     * @return self
     */
    public function setIndices($indices)
    {
        $this->container['indices'] = $indices;

        return $this;
    }

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

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

        return $this;
    }

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

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

        return $this;
    }

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

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

        return $this;
    }

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

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

        return $this;
    }

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

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

        return $this;
    }

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

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

        return $this;
    }

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

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

        return $this;
    }

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

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

        return $this;
    }

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

    /**
     * Sets headers.
     *
     * @param array<string,string> $headers headers
     *
     * @return self
     */
    public function setHeaders($headers)
    {
        $this->container['headers'] = $headers;

        return $this;
    }

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

    /**
     * Sets id.
     *
     * @param null|string $id stable unique identifier for this MCP tool
     *
     * @return self
     */
    public function setId($id)
    {
        $this->container['id'] = $id;

        return $this;
    }

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

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

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