/* tslint:disable */
/* eslint-disable */
/**
 * Data update controller service
 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
 *
 * The version of the OpenAPI document: 0.0.1
 * Contact: aleksey.topunov@rtlabs.ru
 *
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 * https://openapi-generator.tech
 * Do not edit the class manually.
 */


import globalAxios, { AxiosPromise, AxiosInstance, AxiosRequestConfig } from 'axios';
import { Configuration } from '../configuration';
// 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, RequestArgs, BaseAPI, RequiredError } from '../base';
// @ts-ignore
import { ImportXmlResponseV1 } from '../models';
/**
 * ImportApi - axios parameter creator
 * @export
 */
export const ImportApiAxiosParamCreator = function (configuration?: Configuration) {
    return {
        /**
         * Загрузка xml файлов (importFileXml_V1)
         * @summary Импорт xml файлов
         * @param {Array<File>} [files] Массив файлов для импорта граждан
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        importFileXmlV1: async (files?: Array<File>, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
            const localVarPath = `/ervu-import-service/import/v1/xml`;
            // 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;
            const localVarFormParams = new ((configuration && configuration.formDataCtor) || FormData)();

            if (files) {
                files.forEach((element) => {
                    localVarFormParams.append('files', element as any);
                })
            }

    
    
            localVarHeaderParameter['Content-Type'] = 'multipart/form-data';
    
            setSearchParams(localVarUrlObj, localVarQueryParameter);
            let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
            localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
            localVarRequestOptions.data = localVarFormParams;

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

/**
 * ImportApi - functional programming interface
 * @export
 */
export const ImportApiFp = function(configuration?: Configuration) {
    const localVarAxiosParamCreator = ImportApiAxiosParamCreator(configuration)
    return {
        /**
         * Загрузка xml файлов (importFileXml_V1)
         * @summary Импорт xml файлов
         * @param {Array<File>} [files] Массив файлов для импорта граждан
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async importFileXmlV1(files?: Array<File>, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Array<ImportXmlResponseV1>>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.importFileXmlV1(files, options);
            return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
        },
    }
};

/**
 * ImportApi - factory interface
 * @export
 */
export const ImportApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
    const localVarFp = ImportApiFp(configuration)
    return {
        /**
         * Загрузка xml файлов (importFileXml_V1)
         * @summary Импорт xml файлов
         * @param {Array<File>} [files] Массив файлов для импорта граждан
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        importFileXmlV1(files?: Array<File>, options?: any): AxiosPromise<Array<ImportXmlResponseV1>> {
            return localVarFp.importFileXmlV1(files, options).then((request) => request(axios, basePath));
        },
    };
};

/**
 * ImportApi - object-oriented interface
 * @export
 * @class ImportApi
 * @extends {BaseAPI}
 */
export class ImportApi extends BaseAPI {
    /**
     * Загрузка xml файлов (importFileXml_V1)
     * @summary Импорт xml файлов
     * @param {Array<File>} [files] Массив файлов для импорта граждан
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof ImportApi
     */
    public importFileXmlV1(files?: Array<File>, options?: AxiosRequestConfig) {
        return ImportApiFp(this.configuration).importFileXmlV1(files, options).then((request) => request(this.axios, this.basePath));
    }
}
