<?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\FlowFramework\Create;
use OpenSearch\Endpoints\FlowFramework\Delete;
use OpenSearch\Endpoints\FlowFramework\Deprovision;
use OpenSearch\Endpoints\FlowFramework\Get;
use OpenSearch\Endpoints\FlowFramework\GetStatus;
use OpenSearch\Endpoints\FlowFramework\GetSteps;
use OpenSearch\Endpoints\FlowFramework\Provision;
use OpenSearch\Endpoints\FlowFramework\Search;
use OpenSearch\Endpoints\FlowFramework\SearchState;
use OpenSearch\Endpoints\FlowFramework\Update;

/**
 * Class FlowFrameworkNamespace
 *
 * NOTE: This file is autogenerated using util/GenerateEndpoints.php
 */
class FlowFrameworkNamespace extends AbstractNamespace
{
    /**
     * Creates a new workflow template.
     *
     * @param array{provision?: bool, reprovision?: bool, update_fields?: bool, use_case?: string, validation?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params
     * - provision: (Default: false)
     * - reprovision: (Default: false)
     * - update_fields: (Default: false)
     * - use_case: Specifies the workflow template to use.
     * - validation: (Default: all)
     * - 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 create(array $params = [])
    {
        $body = $this->extractArgument($params, 'body');

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

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

    /**
     * Deletes a workflow template.
     *
     * @param array{workflow_id?: string, clear_status?: bool, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params
     * - workflow_id:
     * - clear_status: (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 delete(array $params = [])
    {
        $workflow_id = $this->extractArgument($params, 'workflow_id');

        $endpoint = $this->endpointFactory->getEndpoint(Delete::class);
        $endpoint->setParams($params);
        $endpoint->setWorkflowId($workflow_id);

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

    /**
     * Deprovision workflow's resources when you no longer need them.
     *
     * @param array{workflow_id?: string, allow_delete?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params
     * - workflow_id:
     * - allow_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 deprovision(array $params = [])
    {
        $workflow_id = $this->extractArgument($params, 'workflow_id');

        $endpoint = $this->endpointFactory->getEndpoint(Deprovision::class);
        $endpoint->setParams($params);
        $endpoint->setWorkflowId($workflow_id);

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

    /**
     * Retrieves a workflow template.
     *
     * @param array{workflow_id?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params
     * - workflow_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 get(array $params = [])
    {
        $workflow_id = $this->extractArgument($params, 'workflow_id');

        $endpoint = $this->endpointFactory->getEndpoint(Get::class);
        $endpoint->setParams($params);
        $endpoint->setWorkflowId($workflow_id);

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

    /**
     * Retrieves the current workflow provisioning status.
     *
     * @param array{workflow_id?: string, all?: bool, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params
     * - workflow_id:
     * - all: Whether to return all fields in the response. (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 getStatus(array $params = [])
    {
        $workflow_id = $this->extractArgument($params, 'workflow_id');

        $endpoint = $this->endpointFactory->getEndpoint(GetStatus::class);
        $endpoint->setParams($params);
        $endpoint->setWorkflowId($workflow_id);

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

    /**
     * Retrieves available workflow steps.
     *
     * @param array{workflow_step?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed} $params
     * - workflow_step:
     * - 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 getSteps(array $params = [])
    {

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

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

    /**
     * Provisioning a workflow. This API is also executed when the Create or Update Workflow API is called with the provision parameter set to true.
     *
     * @param array{workflow_id?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params
     * - workflow_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:
     * @return array
     */
    public function provision(array $params = [])
    {
        $workflow_id = $this->extractArgument($params, 'workflow_id');
        $body = $this->extractArgument($params, 'body');

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

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

    /**
     * Search for workflows by using a query matching a field.
     *
     * @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 search(array $params = [])
    {
        $body = $this->extractArgument($params, 'body');

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

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

    /**
     * Search for workflows by using a query matching a field.
     *
     * @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 searchState(array $params = [])
    {
        $body = $this->extractArgument($params, 'body');

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

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

    /**
     * Updates a workflow template that has not been provisioned.
     *
     * @param array{workflow_id?: string, provision?: bool, reprovision?: bool, update_fields?: bool, use_case?: string, validation?: string, pretty?: bool, human?: bool, error_trace?: bool, source?: string, filter_path?: mixed, body?: mixed} $params
     * - workflow_id:
     * - provision: (Default: false)
     * - reprovision: (Default: false)
     * - update_fields: (Default: false)
     * - use_case: Specifies the workflow template to use.
     * - validation: (Default: all)
     * - 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 update(array $params = [])
    {
        $workflow_id = $this->extractArgument($params, 'workflow_id');
        $body = $this->extractArgument($params, 'body');

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

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

}
