/* 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 { AlertConfig } from '../models';
// @ts-ignore
import type { AlertSMSConfig } from '../models';
/**
 * AlertConfigApi - axios parameter creator
 * @export
 */
export const AlertConfigApiAxiosParamCreator = function (configuration?: Configuration) {
    return {
        /**
         * 
         * @summary Get alert SMS config
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getAlertSMSConfig: async (options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            const localVarPath = `/admin/v1/alertSMSConfig`;
            // 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 Get alert time zone config
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getAlertTZConfig: async (options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            const localVarPath = `/admin/v1/alerts/config`;
            // 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 Set alert timezone config
         * @param {AlertConfig} [alertConfig] 
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        setAlertTZConfig: async (alertConfig?: AlertConfig, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            const localVarPath = `/admin/v1/alerts/config`;
            // 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(alertConfig, localVarRequestOptions, configuration)

            return {
                url: toPathString(localVarUrlObj),
                options: localVarRequestOptions,
            };
        },
        /**
         * 
         * @summary Update alert SMS config
         * @param {AlertSMSConfig} body 
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        updateAlertSMSConfig: async (body: AlertSMSConfig, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            // verify required parameter 'body' is not null or undefined
            assertParamExists('updateAlertSMSConfig', 'body', body)
            const localVarPath = `/admin/v1/alertSMSConfig`;
            // 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,
            };
        },
    }
};

/**
 * AlertConfigApi - functional programming interface
 * @export
 */
export const AlertConfigApiFp = function(configuration?: Configuration) {
    const localVarAxiosParamCreator = AlertConfigApiAxiosParamCreator(configuration)
    return {
        /**
         * 
         * @summary Get alert SMS config
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async getAlertSMSConfig(options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<AlertSMSConfig>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.getAlertSMSConfig(options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['AlertConfigApi.getAlertSMSConfig']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
        /**
         * 
         * @summary Get alert time zone config
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async getAlertTZConfig(options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<AlertConfig>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.getAlertTZConfig(options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['AlertConfigApi.getAlertTZConfig']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
        /**
         * 
         * @summary Set alert timezone config
         * @param {AlertConfig} [alertConfig] 
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async setAlertTZConfig(alertConfig?: AlertConfig, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<AlertConfig>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.setAlertTZConfig(alertConfig, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['AlertConfigApi.setAlertTZConfig']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
        /**
         * 
         * @summary Update alert SMS config
         * @param {AlertSMSConfig} body 
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async updateAlertSMSConfig(body: AlertSMSConfig, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<AlertSMSConfig>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.updateAlertSMSConfig(body, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['AlertConfigApi.updateAlertSMSConfig']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
    }
};

/**
 * AlertConfigApi - factory interface
 * @export
 */
export const AlertConfigApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
    const localVarFp = AlertConfigApiFp(configuration)
    return {
        /**
         * 
         * @summary Get alert SMS config
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getAlertSMSConfig(options?: RawAxiosRequestConfig): AxiosPromise<AlertSMSConfig> {
            return localVarFp.getAlertSMSConfig(options).then((request) => request(axios, basePath));
        },
        /**
         * 
         * @summary Get alert time zone config
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getAlertTZConfig(options?: RawAxiosRequestConfig): AxiosPromise<AlertConfig> {
            return localVarFp.getAlertTZConfig(options).then((request) => request(axios, basePath));
        },
        /**
         * 
         * @summary Set alert timezone config
         * @param {AlertConfigApiSetAlertTZConfigRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        setAlertTZConfig(requestParameters: AlertConfigApiSetAlertTZConfigRequest = {}, options?: RawAxiosRequestConfig): AxiosPromise<AlertConfig> {
            return localVarFp.setAlertTZConfig(requestParameters.alertConfig, options).then((request) => request(axios, basePath));
        },
        /**
         * 
         * @summary Update alert SMS config
         * @param {AlertConfigApiUpdateAlertSMSConfigRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        updateAlertSMSConfig(requestParameters: AlertConfigApiUpdateAlertSMSConfigRequest, options?: RawAxiosRequestConfig): AxiosPromise<AlertSMSConfig> {
            return localVarFp.updateAlertSMSConfig(requestParameters.body, options).then((request) => request(axios, basePath));
        },
    };
};

/**
 * AlertConfigApi - interface
 * @export
 * @interface AlertConfigApi
 */
export interface AlertConfigApiInterface {
    /**
     * 
     * @summary Get alert SMS config
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof AlertConfigApiInterface
     */
    getAlertSMSConfig(options?: RawAxiosRequestConfig): AxiosPromise<AlertSMSConfig>;

    /**
     * 
     * @summary Get alert time zone config
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof AlertConfigApiInterface
     */
    getAlertTZConfig(options?: RawAxiosRequestConfig): AxiosPromise<AlertConfig>;

    /**
     * 
     * @summary Set alert timezone config
     * @param {AlertConfigApiSetAlertTZConfigRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof AlertConfigApiInterface
     */
    setAlertTZConfig(requestParameters?: AlertConfigApiSetAlertTZConfigRequest, options?: RawAxiosRequestConfig): AxiosPromise<AlertConfig>;

    /**
     * 
     * @summary Update alert SMS config
     * @param {AlertConfigApiUpdateAlertSMSConfigRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof AlertConfigApiInterface
     */
    updateAlertSMSConfig(requestParameters: AlertConfigApiUpdateAlertSMSConfigRequest, options?: RawAxiosRequestConfig): AxiosPromise<AlertSMSConfig>;

}

/**
 * Request parameters for setAlertTZConfig operation in AlertConfigApi.
 * @export
 * @interface AlertConfigApiSetAlertTZConfigRequest
 */
export interface AlertConfigApiSetAlertTZConfigRequest {
    /**
     * 
     * @type {AlertConfig}
     * @memberof AlertConfigApiSetAlertTZConfig
     */
    readonly alertConfig?: AlertConfig
}

/**
 * Request parameters for updateAlertSMSConfig operation in AlertConfigApi.
 * @export
 * @interface AlertConfigApiUpdateAlertSMSConfigRequest
 */
export interface AlertConfigApiUpdateAlertSMSConfigRequest {
    /**
     * 
     * @type {AlertSMSConfig}
     * @memberof AlertConfigApiUpdateAlertSMSConfig
     */
    readonly body: AlertSMSConfig
}

/**
 * AlertConfigApi - object-oriented interface
 * @export
 * @class AlertConfigApi
 * @extends {BaseAPI}
 */
export class AlertConfigApi extends BaseAPI implements AlertConfigApiInterface {
    /**
     * 
     * @summary Get alert SMS config
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof AlertConfigApi
     */
    public getAlertSMSConfig(options?: RawAxiosRequestConfig) {
        return AlertConfigApiFp(this.configuration).getAlertSMSConfig(options).then((request) => request(this.axios, this.basePath));
    }

    /**
     * 
     * @summary Get alert time zone config
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof AlertConfigApi
     */
    public getAlertTZConfig(options?: RawAxiosRequestConfig) {
        return AlertConfigApiFp(this.configuration).getAlertTZConfig(options).then((request) => request(this.axios, this.basePath));
    }

    /**
     * 
     * @summary Set alert timezone config
     * @param {AlertConfigApiSetAlertTZConfigRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof AlertConfigApi
     */
    public setAlertTZConfig(requestParameters: AlertConfigApiSetAlertTZConfigRequest = {}, options?: RawAxiosRequestConfig) {
        return AlertConfigApiFp(this.configuration).setAlertTZConfig(requestParameters.alertConfig, options).then((request) => request(this.axios, this.basePath));
    }

    /**
     * 
     * @summary Update alert SMS config
     * @param {AlertConfigApiUpdateAlertSMSConfigRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof AlertConfigApi
     */
    public updateAlertSMSConfig(requestParameters: AlertConfigApiUpdateAlertSMSConfigRequest, options?: RawAxiosRequestConfig) {
        return AlertConfigApiFp(this.configuration).updateAlertSMSConfig(requestParameters.body, options).then((request) => request(this.axios, this.basePath));
    }
}

