/* tslint:disable */
/* eslint-disable */
/**
 * Admin API
 * The Admin API is used to manage the ApeCloud platform. 
 *
 * The version of the OpenAPI document: 1.0.0
 * Contact: support@apecloud.com
 *
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 * https://openapi-generator.tech
 * Do not edit the class manually.
 */


import type { Configuration } from '../configuration';
import type { AxiosPromise, AxiosInstance, RawAxiosRequestConfig } from 'axios';
import globalAxios from 'axios';
// Some imports not used depending on template conditions
// @ts-ignore
import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from '../common';
// @ts-ignore
import { BASE_PATH, COLLECTION_FORMATS, type RequestArgs, BaseAPI, RequiredError, operationServerMap } from '../base';
// @ts-ignore
import type { APIErrorResponse } from '../models';
// @ts-ignore
import type { AlertStrategy } from '../models';
// @ts-ignore
import type { AlertStrategyList } from '../models';
/**
 * AlertStrategyApi - axios parameter creator
 * @export
 */
export const AlertStrategyApiAxiosParamCreator = function (configuration?: Configuration) {
    return {
        /**
         * 
         * @summary Create alert strategy
         * @param {AlertStrategy} body 
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        createAlertStrategy: async (body: AlertStrategy, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            // verify required parameter 'body' is not null or undefined
            assertParamExists('createAlertStrategy', 'body', body)
            const localVarPath = `/admin/v1/alerts/strategies`;
            // use dummy base URL string because the URL constructor only accepts absolute URLs.
            const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
            let baseOptions;
            if (configuration) {
                baseOptions = configuration.baseOptions;
            }

            const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options};
            const localVarHeaderParameter = {} as any;
            const localVarQueryParameter = {} as any;

            // authentication BearerToken required
            // http bearer authentication required
            await setBearerAuthToObject(localVarHeaderParameter, configuration)

            // authentication DigestAuth required
            await setApiKeyToObject(localVarHeaderParameter, "Authorization", configuration)


    
            localVarHeaderParameter['Content-Type'] = 'application/json';

            setSearchParams(localVarUrlObj, localVarQueryParameter);
            let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
            localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
            localVarRequestOptions.data = serializeDataIfNeeded(body, localVarRequestOptions, configuration)

            return {
                url: toPathString(localVarUrlObj),
                options: localVarRequestOptions,
            };
        },
        /**
         * 
         * @summary Delete alert strategy
         * @param {string} strategyId id of the alert strategy
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        deleteAlertStrategy: async (strategyId: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            // verify required parameter 'strategyId' is not null or undefined
            assertParamExists('deleteAlertStrategy', 'strategyId', strategyId)
            const localVarPath = `/admin/v1/alerts/strategies/{strategyId}`
                .replace(`{${"strategyId"}}`, encodeURIComponent(String(strategyId)));
            // use dummy base URL string because the URL constructor only accepts absolute URLs.
            const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
            let baseOptions;
            if (configuration) {
                baseOptions = configuration.baseOptions;
            }

            const localVarRequestOptions = { method: 'DELETE', ...baseOptions, ...options};
            const localVarHeaderParameter = {} as any;
            const localVarQueryParameter = {} as any;

            // authentication BearerToken required
            // http bearer authentication required
            await setBearerAuthToObject(localVarHeaderParameter, configuration)

            // authentication DigestAuth required
            await setApiKeyToObject(localVarHeaderParameter, "Authorization", configuration)


    
            setSearchParams(localVarUrlObj, localVarQueryParameter);
            let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
            localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};

            return {
                url: toPathString(localVarUrlObj),
                options: localVarRequestOptions,
            };
        },
        /**
         * 
         * @summary List alert strategies
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        listAlertStrategies: async (options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            const localVarPath = `/admin/v1/alerts/strategies`;
            // use dummy base URL string because the URL constructor only accepts absolute URLs.
            const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
            let baseOptions;
            if (configuration) {
                baseOptions = configuration.baseOptions;
            }

            const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options};
            const localVarHeaderParameter = {} as any;
            const localVarQueryParameter = {} as any;

            // authentication BearerToken required
            // http bearer authentication required
            await setBearerAuthToObject(localVarHeaderParameter, configuration)

            // authentication DigestAuth required
            await setApiKeyToObject(localVarHeaderParameter, "Authorization", configuration)


    
            setSearchParams(localVarUrlObj, localVarQueryParameter);
            let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
            localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};

            return {
                url: toPathString(localVarUrlObj),
                options: localVarRequestOptions,
            };
        },
        /**
         * 
         * @summary Update alert strategy
         * @param {AlertStrategy} body 
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        updateAlertStrategy: async (body: AlertStrategy, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            // verify required parameter 'body' is not null or undefined
            assertParamExists('updateAlertStrategy', 'body', body)
            const localVarPath = `/admin/v1/alerts/strategies`;
            // use dummy base URL string because the URL constructor only accepts absolute URLs.
            const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
            let baseOptions;
            if (configuration) {
                baseOptions = configuration.baseOptions;
            }

            const localVarRequestOptions = { method: 'PATCH', ...baseOptions, ...options};
            const localVarHeaderParameter = {} as any;
            const localVarQueryParameter = {} as any;

            // authentication BearerToken required
            // http bearer authentication required
            await setBearerAuthToObject(localVarHeaderParameter, configuration)

            // authentication DigestAuth required
            await setApiKeyToObject(localVarHeaderParameter, "Authorization", configuration)


    
            localVarHeaderParameter['Content-Type'] = 'application/json';

            setSearchParams(localVarUrlObj, localVarQueryParameter);
            let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
            localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
            localVarRequestOptions.data = serializeDataIfNeeded(body, localVarRequestOptions, configuration)

            return {
                url: toPathString(localVarUrlObj),
                options: localVarRequestOptions,
            };
        },
    }
};

/**
 * AlertStrategyApi - functional programming interface
 * @export
 */
export const AlertStrategyApiFp = function(configuration?: Configuration) {
    const localVarAxiosParamCreator = AlertStrategyApiAxiosParamCreator(configuration)
    return {
        /**
         * 
         * @summary Create alert strategy
         * @param {AlertStrategy} body 
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async createAlertStrategy(body: AlertStrategy, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<AlertStrategy>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.createAlertStrategy(body, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['AlertStrategyApi.createAlertStrategy']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
        /**
         * 
         * @summary Delete alert strategy
         * @param {string} strategyId id of the alert strategy
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async deleteAlertStrategy(strategyId: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<object>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.deleteAlertStrategy(strategyId, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['AlertStrategyApi.deleteAlertStrategy']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
        /**
         * 
         * @summary List alert strategies
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async listAlertStrategies(options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<AlertStrategyList>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.listAlertStrategies(options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['AlertStrategyApi.listAlertStrategies']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
        /**
         * 
         * @summary Update alert strategy
         * @param {AlertStrategy} body 
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async updateAlertStrategy(body: AlertStrategy, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<object>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.updateAlertStrategy(body, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['AlertStrategyApi.updateAlertStrategy']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
    }
};

/**
 * AlertStrategyApi - factory interface
 * @export
 */
export const AlertStrategyApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
    const localVarFp = AlertStrategyApiFp(configuration)
    return {
        /**
         * 
         * @summary Create alert strategy
         * @param {AlertStrategyApiCreateAlertStrategyRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        createAlertStrategy(requestParameters: AlertStrategyApiCreateAlertStrategyRequest, options?: RawAxiosRequestConfig): AxiosPromise<AlertStrategy> {
            return localVarFp.createAlertStrategy(requestParameters.body, options).then((request) => request(axios, basePath));
        },
        /**
         * 
         * @summary Delete alert strategy
         * @param {AlertStrategyApiDeleteAlertStrategyRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        deleteAlertStrategy(requestParameters: AlertStrategyApiDeleteAlertStrategyRequest, options?: RawAxiosRequestConfig): AxiosPromise<object> {
            return localVarFp.deleteAlertStrategy(requestParameters.strategyId, options).then((request) => request(axios, basePath));
        },
        /**
         * 
         * @summary List alert strategies
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        listAlertStrategies(options?: RawAxiosRequestConfig): AxiosPromise<AlertStrategyList> {
            return localVarFp.listAlertStrategies(options).then((request) => request(axios, basePath));
        },
        /**
         * 
         * @summary Update alert strategy
         * @param {AlertStrategyApiUpdateAlertStrategyRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        updateAlertStrategy(requestParameters: AlertStrategyApiUpdateAlertStrategyRequest, options?: RawAxiosRequestConfig): AxiosPromise<object> {
            return localVarFp.updateAlertStrategy(requestParameters.body, options).then((request) => request(axios, basePath));
        },
    };
};

/**
 * AlertStrategyApi - interface
 * @export
 * @interface AlertStrategyApi
 */
export interface AlertStrategyApiInterface {
    /**
     * 
     * @summary Create alert strategy
     * @param {AlertStrategyApiCreateAlertStrategyRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof AlertStrategyApiInterface
     */
    createAlertStrategy(requestParameters: AlertStrategyApiCreateAlertStrategyRequest, options?: RawAxiosRequestConfig): AxiosPromise<AlertStrategy>;

    /**
     * 
     * @summary Delete alert strategy
     * @param {AlertStrategyApiDeleteAlertStrategyRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof AlertStrategyApiInterface
     */
    deleteAlertStrategy(requestParameters: AlertStrategyApiDeleteAlertStrategyRequest, options?: RawAxiosRequestConfig): AxiosPromise<object>;

    /**
     * 
     * @summary List alert strategies
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof AlertStrategyApiInterface
     */
    listAlertStrategies(options?: RawAxiosRequestConfig): AxiosPromise<AlertStrategyList>;

    /**
     * 
     * @summary Update alert strategy
     * @param {AlertStrategyApiUpdateAlertStrategyRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof AlertStrategyApiInterface
     */
    updateAlertStrategy(requestParameters: AlertStrategyApiUpdateAlertStrategyRequest, options?: RawAxiosRequestConfig): AxiosPromise<object>;

}

/**
 * Request parameters for createAlertStrategy operation in AlertStrategyApi.
 * @export
 * @interface AlertStrategyApiCreateAlertStrategyRequest
 */
export interface AlertStrategyApiCreateAlertStrategyRequest {
    /**
     * 
     * @type {AlertStrategy}
     * @memberof AlertStrategyApiCreateAlertStrategy
     */
    readonly body: AlertStrategy
}

/**
 * Request parameters for deleteAlertStrategy operation in AlertStrategyApi.
 * @export
 * @interface AlertStrategyApiDeleteAlertStrategyRequest
 */
export interface AlertStrategyApiDeleteAlertStrategyRequest {
    /**
     * id of the alert strategy
     * @type {string}
     * @memberof AlertStrategyApiDeleteAlertStrategy
     */
    readonly strategyId: string
}

/**
 * Request parameters for updateAlertStrategy operation in AlertStrategyApi.
 * @export
 * @interface AlertStrategyApiUpdateAlertStrategyRequest
 */
export interface AlertStrategyApiUpdateAlertStrategyRequest {
    /**
     * 
     * @type {AlertStrategy}
     * @memberof AlertStrategyApiUpdateAlertStrategy
     */
    readonly body: AlertStrategy
}

/**
 * AlertStrategyApi - object-oriented interface
 * @export
 * @class AlertStrategyApi
 * @extends {BaseAPI}
 */
export class AlertStrategyApi extends BaseAPI implements AlertStrategyApiInterface {
    /**
     * 
     * @summary Create alert strategy
     * @param {AlertStrategyApiCreateAlertStrategyRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof AlertStrategyApi
     */
    public createAlertStrategy(requestParameters: AlertStrategyApiCreateAlertStrategyRequest, options?: RawAxiosRequestConfig) {
        return AlertStrategyApiFp(this.configuration).createAlertStrategy(requestParameters.body, options).then((request) => request(this.axios, this.basePath));
    }

    /**
     * 
     * @summary Delete alert strategy
     * @param {AlertStrategyApiDeleteAlertStrategyRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof AlertStrategyApi
     */
    public deleteAlertStrategy(requestParameters: AlertStrategyApiDeleteAlertStrategyRequest, options?: RawAxiosRequestConfig) {
        return AlertStrategyApiFp(this.configuration).deleteAlertStrategy(requestParameters.strategyId, options).then((request) => request(this.axios, this.basePath));
    }

    /**
     * 
     * @summary List alert strategies
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof AlertStrategyApi
     */
    public listAlertStrategies(options?: RawAxiosRequestConfig) {
        return AlertStrategyApiFp(this.configuration).listAlertStrategies(options).then((request) => request(this.axios, this.basePath));
    }

    /**
     * 
     * @summary Update alert strategy
     * @param {AlertStrategyApiUpdateAlertStrategyRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof AlertStrategyApi
     */
    public updateAlertStrategy(requestParameters: AlertStrategyApiUpdateAlertStrategyRequest, options?: RawAxiosRequestConfig) {
        return AlertStrategyApiFp(this.configuration).updateAlertStrategy(requestParameters.body, options).then((request) => request(this.axios, this.basePath));
    }
}

