<?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\Observability\CreateObject;
use OpenSearch\Endpoints\Observability\DeleteObject;
use OpenSearch\Endpoints\Observability\DeleteObjects;
use OpenSearch\Endpoints\Observability\GetLocalstats;
use OpenSearch\Endpoints\Observability\GetObject;
use OpenSearch\Endpoints\Observability\ListObjects;
use OpenSearch\Endpoints\Observability\UpdateObject;

/**
 * Class ObservabilityNamespace
 *
 * NOTE: This file is autogenerated using util/GenerateEndpoints.php
 */
class ObservabilityNamespace extends AbstractNamespace
{
    /**
     * Creates a new observability object.
     *
     * @param array{pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params
     * - 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 `-`.
     * - body:
     * @return array
     */
    public function createObject(array $params = [])
    {
        $body = $this->extractArgument($params, 'body');

        $endpoint = $this->endpointFactory->getEndpoint(CreateObject::class);
        $endpoint->setParams($params);
        $endpoint->setBody($body);

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

    /**
     * Deletes specific observability object specified by ID.
     *
     * @param array{object_id?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params
     * - object_id: The ID of the observability object to delete.
     * - 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 deleteObject(array $params = [])
    {
        $object_id = $this->extractArgument($params, 'object_id');

        $endpoint = $this->endpointFactory->getEndpoint(DeleteObject::class);
        $endpoint->setParams($params);
        $endpoint->setObjectId($object_id);

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

    /**
     * Deletes specific observability objects specified by ID or a list of IDs.
     *
     * @param array{objectId?: string, objectIdList?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params
     * - objectId: The ID of a single observability object to delete.
     * - objectIdList: A comma-separated list of observability object IDs to delete.
     * - 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 deleteObjects(array $params = [])
    {

        $endpoint = $this->endpointFactory->getEndpoint(DeleteObjects::class);
        $endpoint->setParams($params);

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

    /**
     * Retrieves local stats of all observability objects.
     *
     * @param array{pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params
     * - 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 getLocalstats(array $params = [])
    {

        $endpoint = $this->endpointFactory->getEndpoint(GetLocalstats::class);
        $endpoint->setParams($params);

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

    /**
     * Retrieves specific observability object specified by ID.
     *
     * @param array{object_id?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params
     * - object_id: The ID of the observability object to retrieve.
     * - 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 getObject(array $params = [])
    {
        $object_id = $this->extractArgument($params, 'object_id');

        $endpoint = $this->endpointFactory->getEndpoint(GetObject::class);
        $endpoint->setParams($params);
        $endpoint->setObjectId($object_id);

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

    /**
     * Retrieves list of all observability objects.
     *
     * @param array{pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params
     * - 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 listObjects(array $params = [])
    {

        $endpoint = $this->endpointFactory->getEndpoint(ListObjects::class);
        $endpoint->setParams($params);

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

    /**
     * Updates an existing observability object.
     *
     * @param array{object_id?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params
     * - object_id: The ID of the observability object to update.
     * - 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 `-`.
     * - body:
     * @return array
     */
    public function updateObject(array $params = [])
    {
        $object_id = $this->extractArgument($params, 'object_id');
        $body = $this->extractArgument($params, 'body');

        $endpoint = $this->endpointFactory->getEndpoint(UpdateObject::class);
        $endpoint->setParams($params);
        $endpoint->setObjectId($object_id);
        $endpoint->setBody($body);

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

}
