/* 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 {
  CreateFacilityContactRequest,
  FacilityContactResponse,
  UpdateFacilityContactRequest,
} from '../models/index';
import {
    CreateFacilityContactRequestFromJSON,
    CreateFacilityContactRequestToJSON,
    FacilityContactResponseFromJSON,
    FacilityContactResponseToJSON,
    UpdateFacilityContactRequestFromJSON,
    UpdateFacilityContactRequestToJSON,
} from '../models/index';

export interface ApiFacilitiesFacilityIdContactsGetRequest {
    facilityId: string;
}

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

export interface ApiFacilitiesFacilityIdContactsIdPutRequest {
    facilityId: string;
    id: string;
    updateFacilityContactRequest?: UpdateFacilityContactRequest;
}

export interface ApiFacilitiesFacilityIdContactsPostRequest {
    facilityId: string;
    createFacilityContactRequest?: CreateFacilityContactRequest;
}

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

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

        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}/contacts`;
        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(FacilityContactResponseFromJSON));
    }

    /**
     */
    async apiFacilitiesFacilityIdContactsGet(requestParameters: ApiFacilitiesFacilityIdContactsGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Array<FacilityContactResponse>> {
        const response = await this.apiFacilitiesFacilityIdContactsGetRaw(requestParameters, initOverrides);
        return await response.value();
    }

    /**
     */
    async apiFacilitiesFacilityIdContactsIdDeleteRaw(requestParameters: ApiFacilitiesFacilityIdContactsIdDeleteRequest, 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 apiFacilitiesFacilityIdContactsIdDelete().'
            );
        }

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

        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}/contacts/{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 apiFacilitiesFacilityIdContactsIdDelete(requestParameters: ApiFacilitiesFacilityIdContactsIdDeleteRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void> {
        await this.apiFacilitiesFacilityIdContactsIdDeleteRaw(requestParameters, initOverrides);
    }

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

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

        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}/contacts/{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: UpdateFacilityContactRequestToJSON(requestParameters['updateFacilityContactRequest']),
        }, initOverrides);

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

    /**
     */
    async apiFacilitiesFacilityIdContactsIdPut(requestParameters: ApiFacilitiesFacilityIdContactsIdPutRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<FacilityContactResponse> {
        const response = await this.apiFacilitiesFacilityIdContactsIdPutRaw(requestParameters, initOverrides);
        return await response.value();
    }

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

        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}/contacts`;
        urlPath = urlPath.replace(`{${"facilityId"}}`, encodeURIComponent(String(requestParameters['facilityId'])));

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

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

    /**
     */
    async apiFacilitiesFacilityIdContactsPost(requestParameters: ApiFacilitiesFacilityIdContactsPostRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<FacilityContactResponse> {
        const response = await this.apiFacilitiesFacilityIdContactsPostRaw(requestParameters, initOverrides);
        return await response.value();
    }

}
