<?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\Notifications\CreateConfig;
use OpenSearch\Endpoints\Notifications\DeleteConfig;
use OpenSearch\Endpoints\Notifications\DeleteConfigs;
use OpenSearch\Endpoints\Notifications\GetConfig;
use OpenSearch\Endpoints\Notifications\GetConfigs;
use OpenSearch\Endpoints\Notifications\ListChannels;
use OpenSearch\Endpoints\Notifications\ListFeatures;
use OpenSearch\Endpoints\Notifications\SendTest;
use OpenSearch\Endpoints\Notifications\UpdateConfig;

/**
 * Class NotificationsNamespace
 *
 * NOTE: This file is autogenerated using util/GenerateEndpoints.php
 */
class NotificationsNamespace extends AbstractNamespace
{
    /**
     * Create channel configuration.
     *
     * @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: (Required)
     * @return array
     */
    public function createConfig(array $params = [])
    {
        $body = $this->extractArgument($params, 'body');

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

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

    /**
     * Delete a channel configuration.
     *
     * @param array{config_id?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params
     * - config_id: The ID of the channel configuration 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 deleteConfig(array $params = [])
    {
        $config_id = $this->extractArgument($params, 'config_id');

        $endpoint = $this->endpointFactory->getEndpoint(DeleteConfig::class);
        $endpoint->setParams($params);
        $endpoint->setConfigId($config_id);

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

    /**
     * Delete multiple channel configurations.
     *
     * @param array{config_id?: string, config_id_list?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params
     * - config_id: The ID of the channel configuration to delete.
     * - config_id_list: A comma-separated list of channel 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 deleteConfigs(array $params = [])
    {

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

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

    /**
     * Get a specific channel configuration.
     *
     * @param array{config_id?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params
     * - config_id:
     * - 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 getConfig(array $params = [])
    {
        $config_id = $this->extractArgument($params, 'config_id');

        $endpoint = $this->endpointFactory->getEndpoint(GetConfig::class);
        $endpoint->setParams($params);
        $endpoint->setConfigId($config_id);

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

    /**
     * Get multiple channel configurations with filtering.
     *
     * @param array{'chime.url'?: string, 'chime.url.keyword'?: string, config_id?: string, config_id_list?: mixed, config_type?: mixed, created_time_ms?: int, description?: string, 'description.keyword'?: string, 'email.email_account_id'?: string, 'email.email_group_id_list'?: string, 'email.recipient_list.recipient'?: string, 'email.recipient_list.recipient.keyword'?: string, 'email_group.recipient_list.recipient'?: string, 'email_group.recipient_list.recipient.keyword'?: string, is_enabled?: bool, last_updated_time_ms?: int, 'microsoft_teams.url'?: string, 'microsoft_teams.url.keyword'?: string, name?: string, 'name.keyword'?: string, query?: string, 'ses_account.from_address'?: string, 'ses_account.from_address.keyword'?: string, 'ses_account.region'?: string, 'ses_account.role_arn'?: string, 'ses_account.role_arn.keyword'?: string, 'slack.url'?: string, 'slack.url.keyword'?: string, 'smtp_account.from_address'?: string, 'smtp_account.from_address.keyword'?: string, 'smtp_account.host'?: string, 'smtp_account.host.keyword'?: string, 'smtp_account.method'?: string, 'sns.role_arn'?: string, 'sns.role_arn.keyword'?: string, 'sns.topic_arn'?: string, 'sns.topic_arn.keyword'?: string, text_query?: string, 'webhook.url'?: string, 'webhook.url.keyword'?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params
     * - chime.url:
     * - chime.url.keyword:
     * - config_id: Notification configuration ID.
     * - config_id_list: Notification configuration IDs.
     * - config_type: Type of notification configuration. (Options: chime, email, email_group, microsoft_teams, ses_account, slack, smtp_account, sns, webhook)
     * - created_time_ms:
     * - description:
     * - description.keyword:
     * - email.email_account_id:
     * - email.email_group_id_list:
     * - email.recipient_list.recipient:
     * - email.recipient_list.recipient.keyword:
     * - email_group.recipient_list.recipient:
     * - email_group.recipient_list.recipient.keyword:
     * - is_enabled:
     * - last_updated_time_ms:
     * - microsoft_teams.url:
     * - microsoft_teams.url.keyword:
     * - name:
     * - name.keyword:
     * - query:
     * - ses_account.from_address:
     * - ses_account.from_address.keyword:
     * - ses_account.region:
     * - ses_account.role_arn:
     * - ses_account.role_arn.keyword:
     * - slack.url:
     * - slack.url.keyword:
     * - smtp_account.from_address:
     * - smtp_account.from_address.keyword:
     * - smtp_account.host:
     * - smtp_account.host.keyword:
     * - smtp_account.method:
     * - sns.role_arn:
     * - sns.role_arn.keyword:
     * - sns.topic_arn:
     * - sns.topic_arn.keyword:
     * - text_query:
     * - webhook.url:
     * - webhook.url.keyword:
     * - 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 getConfigs(array $params = [])
    {
        $body = $this->extractArgument($params, 'body');

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

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

    /**
     * List created notification channels.
     *
     * @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 listChannels(array $params = [])
    {

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

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

    /**
     * List supported channel configurations.
     *
     * @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 listFeatures(array $params = [])
    {

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

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

    /**
     * Send a test notification.
     *
     * @param array{config_id?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params
     * - config_id:
     * - 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 sendTest(array $params = [])
    {
        $config_id = $this->extractArgument($params, 'config_id');

        $endpoint = $this->endpointFactory->getEndpoint(SendTest::class);
        $endpoint->setParams($params);
        $endpoint->setConfigId($config_id);

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

    /**
     * Update channel configuration.
     *
     * @param array{config_id?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params
     * - config_id:
     * - 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: (Required)
     * @return array
     */
    public function updateConfig(array $params = [])
    {
        $config_id = $this->extractArgument($params, 'config_id');
        $body = $this->extractArgument($params, 'body');

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

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

}
