/* tslint:disable */
/* eslint-disable */
/**
 * OmsorgCore.Api
 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
 *
 * The version of the OpenAPI document: 1.0
 * 
 *
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 * https://openapi-generator.tech
 * Do not edit the class manually.
 */


import * as runtime from '../runtime';
import type {
  CreateEmployeeFacilityDistanceRequest,
  EmployeeFacilityDistanceResponse,
  UpdateEmployeeFacilityDistanceRequest,
} from '../models/index';
import {
    CreateEmployeeFacilityDistanceRequestFromJSON,
    CreateEmployeeFacilityDistanceRequestToJSON,
    EmployeeFacilityDistanceResponseFromJSON,
    EmployeeFacilityDistanceResponseToJSON,
    UpdateEmployeeFacilityDistanceRequestFromJSON,
    UpdateEmployeeFacilityDistanceRequestToJSON,
} from '../models/index';

export interface ApiFacilitiesFacilityIdEmployeeDistancesGetRequest {
    facilityId: string;
}

export interface ApiFacilitiesFacilityIdEmployeeDistancesIdDeleteRequest {
    facilityId: string;
    id: string;
}

export interface ApiFacilitiesFacilityIdEmployeeDistancesIdPutRequest {
    facilityId: string;
    id: string;
    updateEmployeeFacilityDistanceRequest?: UpdateEmployeeFacilityDistanceRequest;
}

export interface ApiFacilitiesFacilityIdEmployeeDistancesPostRequest {
    facilityId: string;
    createEmployeeFacilityDistanceRequest?: CreateEmployeeFacilityDistanceRequest;
}

/**
 * 
 */
export class EmployeeFacilityDistancesApi extends runtime.BaseAPI {

    /**
     */
    async apiFacilitiesFacilityIdEmployeeDistancesGetRaw(requestParameters: ApiFacilitiesFacilityIdEmployeeDistancesGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Array<EmployeeFacilityDistanceResponse>>> {
        if (requestParameters['facilityId'] == null) {
            throw new runtime.RequiredError(
                'facilityId',
                'Required parameter "facilityId" was null or undefined when calling apiFacilitiesFacilityIdEmployeeDistancesGet().'
            );
        }

        const queryParameters: any = {};

        const headerParameters: runtime.HTTPHeaders = {};

        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("Bearer", []);

            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }

        let urlPath = `/api/facilities/{facilityId}/employee-distances`;
        urlPath = urlPath.replace(`{${"facilityId"}}`, encodeURIComponent(String(requestParameters['facilityId'])));

        const response = await this.request({
            path: urlPath,
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);

        return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(EmployeeFacilityDistanceResponseFromJSON));
    }

    /**
     */
    async apiFacilitiesFacilityIdEmployeeDistancesGet(requestParameters: ApiFacilitiesFacilityIdEmployeeDistancesGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Array<EmployeeFacilityDistanceResponse>> {
        const response = await this.apiFacilitiesFacilityIdEmployeeDistancesGetRaw(requestParameters, initOverrides);
        return await response.value();
    }

    /**
     */
    async apiFacilitiesFacilityIdEmployeeDistancesIdDeleteRaw(requestParameters: ApiFacilitiesFacilityIdEmployeeDistancesIdDeleteRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>> {
        if (requestParameters['facilityId'] == null) {
            throw new runtime.RequiredError(
                'facilityId',
                'Required parameter "facilityId" was null or undefined when calling apiFacilitiesFacilityIdEmployeeDistancesIdDelete().'
            );
        }

        if (requestParameters['id'] == null) {
            throw new runtime.RequiredError(
                'id',
                'Required parameter "id" was null or undefined when calling apiFacilitiesFacilityIdEmployeeDistancesIdDelete().'
            );
        }

        const queryParameters: any = {};

        const headerParameters: runtime.HTTPHeaders = {};

        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("Bearer", []);

            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }

        let urlPath = `/api/facilities/{facilityId}/employee-distances/{id}`;
        urlPath = urlPath.replace(`{${"facilityId"}}`, encodeURIComponent(String(requestParameters['facilityId'])));
        urlPath = urlPath.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id'])));

        const response = await this.request({
            path: urlPath,
            method: 'DELETE',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);

        return new runtime.VoidApiResponse(response);
    }

    /**
     */
    async apiFacilitiesFacilityIdEmployeeDistancesIdDelete(requestParameters: ApiFacilitiesFacilityIdEmployeeDistancesIdDeleteRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void> {
        await this.apiFacilitiesFacilityIdEmployeeDistancesIdDeleteRaw(requestParameters, initOverrides);
    }

    /**
     */
    async apiFacilitiesFacilityIdEmployeeDistancesIdPutRaw(requestParameters: ApiFacilitiesFacilityIdEmployeeDistancesIdPutRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<EmployeeFacilityDistanceResponse>> {
        if (requestParameters['facilityId'] == null) {
            throw new runtime.RequiredError(
                'facilityId',
                'Required parameter "facilityId" was null or undefined when calling apiFacilitiesFacilityIdEmployeeDistancesIdPut().'
            );
        }

        if (requestParameters['id'] == null) {
            throw new runtime.RequiredError(
                'id',
                'Required parameter "id" was null or undefined when calling apiFacilitiesFacilityIdEmployeeDistancesIdPut().'
            );
        }

        const queryParameters: any = {};

        const headerParameters: runtime.HTTPHeaders = {};

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

        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("Bearer", []);

            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }

        let urlPath = `/api/facilities/{facilityId}/employee-distances/{id}`;
        urlPath = urlPath.replace(`{${"facilityId"}}`, encodeURIComponent(String(requestParameters['facilityId'])));
        urlPath = urlPath.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id'])));

        const response = await this.request({
            path: urlPath,
            method: 'PUT',
            headers: headerParameters,
            query: queryParameters,
            body: UpdateEmployeeFacilityDistanceRequestToJSON(requestParameters['updateEmployeeFacilityDistanceRequest']),
        }, initOverrides);

        return new runtime.JSONApiResponse(response, (jsonValue) => EmployeeFacilityDistanceResponseFromJSON(jsonValue));
    }

    /**
     */
    async apiFacilitiesFacilityIdEmployeeDistancesIdPut(requestParameters: ApiFacilitiesFacilityIdEmployeeDistancesIdPutRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<EmployeeFacilityDistanceResponse> {
        const response = await this.apiFacilitiesFacilityIdEmployeeDistancesIdPutRaw(requestParameters, initOverrides);
        return await response.value();
    }

    /**
     */
    async apiFacilitiesFacilityIdEmployeeDistancesPostRaw(requestParameters: ApiFacilitiesFacilityIdEmployeeDistancesPostRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<EmployeeFacilityDistanceResponse>> {
        if (requestParameters['facilityId'] == null) {
            throw new runtime.RequiredError(
                'facilityId',
                'Required parameter "facilityId" was null or undefined when calling apiFacilitiesFacilityIdEmployeeDistancesPost().'
            );
        }

        const queryParameters: any = {};

        const headerParameters: runtime.HTTPHeaders = {};

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

        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("Bearer", []);

            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }

        let urlPath = `/api/facilities/{facilityId}/employee-distances`;
        urlPath = urlPath.replace(`{${"facilityId"}}`, encodeURIComponent(String(requestParameters['facilityId'])));

        const response = await this.request({
            path: urlPath,
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
            body: CreateEmployeeFacilityDistanceRequestToJSON(requestParameters['createEmployeeFacilityDistanceRequest']),
        }, initOverrides);

        return new runtime.JSONApiResponse(response, (jsonValue) => EmployeeFacilityDistanceResponseFromJSON(jsonValue));
    }

    /**
     */
    async apiFacilitiesFacilityIdEmployeeDistancesPost(requestParameters: ApiFacilitiesFacilityIdEmployeeDistancesPostRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<EmployeeFacilityDistanceResponse> {
        const response = await this.apiFacilitiesFacilityIdEmployeeDistancesPostRaw(requestParameters, initOverrides);
        return await response.value();
    }

}
