<?php

declare(strict_types=1);

/**
 * SPDX-License-Identifier: Apache-2.0
 *
 * The OpenSearch Contributors require contributions made to
 * this file be licensed under the Apache-2.0 license or a
 * compatible open source license.
 *
 * Modifications Copyright OpenSearch Contributors. See
 * GitHub history for details.
 */

namespace OpenSearch\Namespaces;

use OpenSearch\Endpoints\Neural\Stats;

/**
 * Class NeuralNamespace
 *
 * NOTE: This file is autogenerated using util/GenerateEndpoints.php
 */
class NeuralNamespace extends AbstractNamespace
{
    /**
     * Provides information about the current status of the neural-search plugin.
     *
     * @param array{node_id?: string, stat?: mixed, flat_stat_paths?: bool, include_all_nodes?: bool, include_individual_nodes?: bool, include_info?: bool, include_metadata?: bool, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params
     * - node_id: A comma-separated list of node IDs or names to limit the returned information; leave empty to get information from all nodes.
     * - stat: A comma-separated list of stats to retrieve; use empty string to retrieve all stats.
     * - flat_stat_paths: Whether to return stats in the flat form, which can improve readability, especially for heavily nested stats. For example, the flat form of `"processors": { "ingest": { "text_embedding_executions": 20181212 } }` is `"processors.ingest.text_embedding_executions": "20181212"`. (Default: false)
     * - include_all_nodes: When `true` includes aggregated statistics across all nodes in the `all_nodes` category. When `false`, excludes the `all_nodes` category from the response. (Default: true)
     * - include_individual_nodes: When `true` includes statistics for individual nodes in the `nodes` category. When `false`, excludes the `nodes` category from the response. (Default: true)
     * - include_info: When `true` includes cluster-wide information in the `info` category. When `false`, excludes the `info` category from the response. (Default: true)
     * - include_metadata: Whether to return stat metadata instead of the raw stat value, includes additional information about the stat. These can include things like type hints, time since last stats being recorded, or recent rolling interval values (Default: false)
     * - pretty: Whether to pretty-format the returned JSON response. (Default: false)
     * - human: Whether to return human-readable values for statistics. (Default: false)
     * - error_trace: Whether to include the stack trace of returned errors. (Default: false)
     * - source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
     * - filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`.
     * @return array
     */
    public function stats(array $params = [])
    {
        $node_id = $this->extractArgument($params, 'node_id');
        $stat = $this->extractArgument($params, 'stat');

        $endpoint = $this->endpointFactory->getEndpoint(Stats::class);
        $endpoint->setParams($params);
        $endpoint->setNodeId($node_id);
        $endpoint->setStat($stat);

        return $this->performRequest($endpoint);
    }

}
