// tslint:disable
/**
 * Webitel API
 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
 *
 * The version of the OpenAPI document: 24.04.0
 * Contact: support@webitel.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 { __awaiter } from "tslib";
import * as globalImportUrl from 'url';
import globalAxios from 'axios';
// Some imports not used depending on template conditions
// @ts-ignore
import { BASE_PATH, BaseAPI, RequiredError, } from '../base';
/**
 * ShiftTemplateServiceApi - axios parameter creator
 * @export
 */
export const ShiftTemplateServiceApiAxiosParamCreator = function (configuration) {
    return {
        /**
         *
         * @param {WfmCreateShiftTemplateRequest} body
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        createShiftTemplate: (body, options = {}) => __awaiter(this, void 0, void 0, function* () {
            // verify required parameter 'body' is not null or undefined
            if (body === null || body === undefined) {
                throw new RequiredError('body', 'Required parameter body was null or undefined when calling createShiftTemplate.');
            }
            const localVarPath = `/wfm/lookups/shift_templates`;
            const localVarUrlObj = globalImportUrl.parse(localVarPath, true);
            let baseOptions;
            if (configuration) {
                baseOptions = configuration.baseOptions;
            }
            const localVarRequestOptions = Object.assign(Object.assign({ method: 'POST' }, baseOptions), options);
            const localVarHeaderParameter = {};
            const localVarQueryParameter = {};
            // authentication AccessToken required
            if (configuration && configuration.apiKey) {
                const localVarApiKeyValue = typeof configuration.apiKey === 'function'
                    ? yield configuration.apiKey('X-Webitel-Access')
                    : yield configuration.apiKey;
                localVarHeaderParameter['X-Webitel-Access'] = localVarApiKeyValue;
            }
            localVarHeaderParameter['Content-Type'] = 'application/json';
            localVarUrlObj.query = Object.assign(Object.assign(Object.assign({}, localVarUrlObj.query), localVarQueryParameter), options.query);
            // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
            delete localVarUrlObj.search;
            let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
            localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
            const needsSerialization = typeof body !== 'string' ||
                localVarRequestOptions.headers['Content-Type'] === 'application/json';
            localVarRequestOptions.data = needsSerialization
                ? JSON.stringify(body !== undefined ? body : {})
                : body || '';
            return {
                url: globalImportUrl.format(localVarUrlObj),
                options: localVarRequestOptions,
            };
        }),
        /**
         *
         * @param {string} id
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        deleteShiftTemplate: (id, options = {}) => __awaiter(this, void 0, void 0, function* () {
            // verify required parameter 'id' is not null or undefined
            if (id === null || id === undefined) {
                throw new RequiredError('id', 'Required parameter id was null or undefined when calling deleteShiftTemplate.');
            }
            const localVarPath = `/wfm/lookups/shift_templates/{id}`.replace(`{${'id'}}`, encodeURIComponent(String(id)));
            const localVarUrlObj = globalImportUrl.parse(localVarPath, true);
            let baseOptions;
            if (configuration) {
                baseOptions = configuration.baseOptions;
            }
            const localVarRequestOptions = Object.assign(Object.assign({ method: 'DELETE' }, baseOptions), options);
            const localVarHeaderParameter = {};
            const localVarQueryParameter = {};
            // authentication AccessToken required
            if (configuration && configuration.apiKey) {
                const localVarApiKeyValue = typeof configuration.apiKey === 'function'
                    ? yield configuration.apiKey('X-Webitel-Access')
                    : yield configuration.apiKey;
                localVarHeaderParameter['X-Webitel-Access'] = localVarApiKeyValue;
            }
            localVarUrlObj.query = Object.assign(Object.assign(Object.assign({}, localVarUrlObj.query), localVarQueryParameter), options.query);
            // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
            delete localVarUrlObj.search;
            let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
            localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
            return {
                url: globalImportUrl.format(localVarUrlObj),
                options: localVarRequestOptions,
            };
        }),
        /**
         *
         * @param {string} id
         * @param {Array<string>} [fields]
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        readShiftTemplate: (id, fields, options = {}) => __awaiter(this, void 0, void 0, function* () {
            // verify required parameter 'id' is not null or undefined
            if (id === null || id === undefined) {
                throw new RequiredError('id', 'Required parameter id was null or undefined when calling readShiftTemplate.');
            }
            const localVarPath = `/wfm/lookups/shift_templates/{id}`.replace(`{${'id'}}`, encodeURIComponent(String(id)));
            const localVarUrlObj = globalImportUrl.parse(localVarPath, true);
            let baseOptions;
            if (configuration) {
                baseOptions = configuration.baseOptions;
            }
            const localVarRequestOptions = Object.assign(Object.assign({ method: 'GET' }, baseOptions), options);
            const localVarHeaderParameter = {};
            const localVarQueryParameter = {};
            // authentication AccessToken required
            if (configuration && configuration.apiKey) {
                const localVarApiKeyValue = typeof configuration.apiKey === 'function'
                    ? yield configuration.apiKey('X-Webitel-Access')
                    : yield configuration.apiKey;
                localVarHeaderParameter['X-Webitel-Access'] = localVarApiKeyValue;
            }
            if (fields) {
                localVarQueryParameter['fields'] = fields;
            }
            localVarUrlObj.query = Object.assign(Object.assign(Object.assign({}, localVarUrlObj.query), localVarQueryParameter), options.query);
            // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
            delete localVarUrlObj.search;
            let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
            localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
            return {
                url: globalImportUrl.format(localVarUrlObj),
                options: localVarRequestOptions,
            };
        }),
        /**
         *
         * @param {string} [q]
         * @param {number} [page]
         * @param {number} [size]
         * @param {string} [sort]
         * @param {Array<string>} [fields]
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        searchShiftTemplate: (q, page, size, sort, fields, options = {}) => __awaiter(this, void 0, void 0, function* () {
            const localVarPath = `/wfm/lookups/shift_templates`;
            const localVarUrlObj = globalImportUrl.parse(localVarPath, true);
            let baseOptions;
            if (configuration) {
                baseOptions = configuration.baseOptions;
            }
            const localVarRequestOptions = Object.assign(Object.assign({ method: 'GET' }, baseOptions), options);
            const localVarHeaderParameter = {};
            const localVarQueryParameter = {};
            // authentication AccessToken required
            if (configuration && configuration.apiKey) {
                const localVarApiKeyValue = typeof configuration.apiKey === 'function'
                    ? yield configuration.apiKey('X-Webitel-Access')
                    : yield configuration.apiKey;
                localVarHeaderParameter['X-Webitel-Access'] = localVarApiKeyValue;
            }
            if (q !== undefined) {
                localVarQueryParameter['q'] = q;
            }
            if (page !== undefined) {
                localVarQueryParameter['page'] = page;
            }
            if (size !== undefined) {
                localVarQueryParameter['size'] = size;
            }
            if (sort !== undefined) {
                localVarQueryParameter['sort'] = sort;
            }
            if (fields) {
                localVarQueryParameter['fields'] = fields;
            }
            localVarUrlObj.query = Object.assign(Object.assign(Object.assign({}, localVarUrlObj.query), localVarQueryParameter), options.query);
            // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
            delete localVarUrlObj.search;
            let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
            localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
            return {
                url: globalImportUrl.format(localVarUrlObj),
                options: localVarRequestOptions,
            };
        }),
        /**
         *
         * @summary UpdateShiftTemplate updates a shift template with a list times. Update existing time, create that not exists in database and delete that not exists in the list.
         * @param {string} itemId
         * @param {InlineObject9} body
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        updateShiftTemplate: (itemId, body, options = {}) => __awaiter(this, void 0, void 0, function* () {
            // verify required parameter 'itemId' is not null or undefined
            if (itemId === null || itemId === undefined) {
                throw new RequiredError('itemId', 'Required parameter itemId was null or undefined when calling updateShiftTemplate.');
            }
            // verify required parameter 'body' is not null or undefined
            if (body === null || body === undefined) {
                throw new RequiredError('body', 'Required parameter body was null or undefined when calling updateShiftTemplate.');
            }
            const localVarPath = `/wfm/lookups/shift_templates/{item.id}`.replace(`{${'item.id'}}`, encodeURIComponent(String(itemId)));
            const localVarUrlObj = globalImportUrl.parse(localVarPath, true);
            let baseOptions;
            if (configuration) {
                baseOptions = configuration.baseOptions;
            }
            const localVarRequestOptions = Object.assign(Object.assign({ method: 'PUT' }, baseOptions), options);
            const localVarHeaderParameter = {};
            const localVarQueryParameter = {};
            // authentication AccessToken required
            if (configuration && configuration.apiKey) {
                const localVarApiKeyValue = typeof configuration.apiKey === 'function'
                    ? yield configuration.apiKey('X-Webitel-Access')
                    : yield configuration.apiKey;
                localVarHeaderParameter['X-Webitel-Access'] = localVarApiKeyValue;
            }
            localVarHeaderParameter['Content-Type'] = 'application/json';
            localVarUrlObj.query = Object.assign(Object.assign(Object.assign({}, localVarUrlObj.query), localVarQueryParameter), options.query);
            // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
            delete localVarUrlObj.search;
            let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
            localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
            const needsSerialization = typeof body !== 'string' ||
                localVarRequestOptions.headers['Content-Type'] === 'application/json';
            localVarRequestOptions.data = needsSerialization
                ? JSON.stringify(body !== undefined ? body : {})
                : body || '';
            return {
                url: globalImportUrl.format(localVarUrlObj),
                options: localVarRequestOptions,
            };
        }),
    };
};
/**
 * ShiftTemplateServiceApi - functional programming interface
 * @export
 */
export const ShiftTemplateServiceApiFp = function (configuration) {
    return {
        /**
         *
         * @param {WfmCreateShiftTemplateRequest} body
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        createShiftTemplate(body, options) {
            return __awaiter(this, void 0, void 0, function* () {
                const localVarAxiosArgs = yield ShiftTemplateServiceApiAxiosParamCreator(configuration).createShiftTemplate(body, options);
                return (axios = globalAxios, basePath = BASE_PATH) => {
                    const axiosRequestArgs = Object.assign(Object.assign({}, localVarAxiosArgs.options), { url: basePath + localVarAxiosArgs.url });
                    return axios.request(axiosRequestArgs);
                };
            });
        },
        /**
         *
         * @param {string} id
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        deleteShiftTemplate(id, options) {
            return __awaiter(this, void 0, void 0, function* () {
                const localVarAxiosArgs = yield ShiftTemplateServiceApiAxiosParamCreator(configuration).deleteShiftTemplate(id, options);
                return (axios = globalAxios, basePath = BASE_PATH) => {
                    const axiosRequestArgs = Object.assign(Object.assign({}, localVarAxiosArgs.options), { url: basePath + localVarAxiosArgs.url });
                    return axios.request(axiosRequestArgs);
                };
            });
        },
        /**
         *
         * @param {string} id
         * @param {Array<string>} [fields]
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        readShiftTemplate(id, fields, options) {
            return __awaiter(this, void 0, void 0, function* () {
                const localVarAxiosArgs = yield ShiftTemplateServiceApiAxiosParamCreator(configuration).readShiftTemplate(id, fields, options);
                return (axios = globalAxios, basePath = BASE_PATH) => {
                    const axiosRequestArgs = Object.assign(Object.assign({}, localVarAxiosArgs.options), { url: basePath + localVarAxiosArgs.url });
                    return axios.request(axiosRequestArgs);
                };
            });
        },
        /**
         *
         * @param {string} [q]
         * @param {number} [page]
         * @param {number} [size]
         * @param {string} [sort]
         * @param {Array<string>} [fields]
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        searchShiftTemplate(q, page, size, sort, fields, options) {
            return __awaiter(this, void 0, void 0, function* () {
                const localVarAxiosArgs = yield ShiftTemplateServiceApiAxiosParamCreator(configuration).searchShiftTemplate(q, page, size, sort, fields, options);
                return (axios = globalAxios, basePath = BASE_PATH) => {
                    const axiosRequestArgs = Object.assign(Object.assign({}, localVarAxiosArgs.options), { url: basePath + localVarAxiosArgs.url });
                    return axios.request(axiosRequestArgs);
                };
            });
        },
        /**
         *
         * @summary UpdateShiftTemplate updates a shift template with a list times. Update existing time, create that not exists in database and delete that not exists in the list.
         * @param {string} itemId
         * @param {InlineObject9} body
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        updateShiftTemplate(itemId, body, options) {
            return __awaiter(this, void 0, void 0, function* () {
                const localVarAxiosArgs = yield ShiftTemplateServiceApiAxiosParamCreator(configuration).updateShiftTemplate(itemId, body, options);
                return (axios = globalAxios, basePath = BASE_PATH) => {
                    const axiosRequestArgs = Object.assign(Object.assign({}, localVarAxiosArgs.options), { url: basePath + localVarAxiosArgs.url });
                    return axios.request(axiosRequestArgs);
                };
            });
        },
    };
};
/**
 * ShiftTemplateServiceApi - factory interface
 * @export
 */
export const ShiftTemplateServiceApiFactory = function (configuration, basePath, axios) {
    return {
        /**
         *
         * @param {WfmCreateShiftTemplateRequest} body
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        createShiftTemplate(body, options) {
            return ShiftTemplateServiceApiFp(configuration)
                .createShiftTemplate(body, options)
                .then((request) => request(axios, basePath));
        },
        /**
         *
         * @param {string} id
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        deleteShiftTemplate(id, options) {
            return ShiftTemplateServiceApiFp(configuration)
                .deleteShiftTemplate(id, options)
                .then((request) => request(axios, basePath));
        },
        /**
         *
         * @param {string} id
         * @param {Array<string>} [fields]
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        readShiftTemplate(id, fields, options) {
            return ShiftTemplateServiceApiFp(configuration)
                .readShiftTemplate(id, fields, options)
                .then((request) => request(axios, basePath));
        },
        /**
         *
         * @param {string} [q]
         * @param {number} [page]
         * @param {number} [size]
         * @param {string} [sort]
         * @param {Array<string>} [fields]
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        searchShiftTemplate(q, page, size, sort, fields, options) {
            return ShiftTemplateServiceApiFp(configuration)
                .searchShiftTemplate(q, page, size, sort, fields, options)
                .then((request) => request(axios, basePath));
        },
        /**
         *
         * @summary UpdateShiftTemplate updates a shift template with a list times. Update existing time, create that not exists in database and delete that not exists in the list.
         * @param {string} itemId
         * @param {InlineObject9} body
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        updateShiftTemplate(itemId, body, options) {
            return ShiftTemplateServiceApiFp(configuration)
                .updateShiftTemplate(itemId, body, options)
                .then((request) => request(axios, basePath));
        },
    };
};
/**
 * ShiftTemplateServiceApi - object-oriented interface
 * @export
 * @class ShiftTemplateServiceApi
 * @extends {BaseAPI}
 */
export class ShiftTemplateServiceApi extends BaseAPI {
    /**
     *
     * @param {WfmCreateShiftTemplateRequest} body
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof ShiftTemplateServiceApi
     */
    createShiftTemplate(body, options) {
        return ShiftTemplateServiceApiFp(this.configuration)
            .createShiftTemplate(body, options)
            .then((request) => request(this.axios, this.basePath));
    }
    /**
     *
     * @param {string} id
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof ShiftTemplateServiceApi
     */
    deleteShiftTemplate(id, options) {
        return ShiftTemplateServiceApiFp(this.configuration)
            .deleteShiftTemplate(id, options)
            .then((request) => request(this.axios, this.basePath));
    }
    /**
     *
     * @param {string} id
     * @param {Array<string>} [fields]
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof ShiftTemplateServiceApi
     */
    readShiftTemplate(id, fields, options) {
        return ShiftTemplateServiceApiFp(this.configuration)
            .readShiftTemplate(id, fields, options)
            .then((request) => request(this.axios, this.basePath));
    }
    /**
     *
     * @param {string} [q]
     * @param {number} [page]
     * @param {number} [size]
     * @param {string} [sort]
     * @param {Array<string>} [fields]
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof ShiftTemplateServiceApi
     */
    searchShiftTemplate(q, page, size, sort, fields, options) {
        return ShiftTemplateServiceApiFp(this.configuration)
            .searchShiftTemplate(q, page, size, sort, fields, options)
            .then((request) => request(this.axios, this.basePath));
    }
    /**
     *
     * @summary UpdateShiftTemplate updates a shift template with a list times. Update existing time, create that not exists in database and delete that not exists in the list.
     * @param {string} itemId
     * @param {InlineObject9} body
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof ShiftTemplateServiceApi
     */
    updateShiftTemplate(itemId, body, options) {
        return ShiftTemplateServiceApiFp(this.configuration)
            .updateShiftTemplate(itemId, body, options)
            .then((request) => request(this.axios, this.basePath));
    }
}
//# sourceMappingURL=shift-template-service-api.js.map