/* 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 {
  CreateEmployeeRequest,
  EmployeeResponse,
  EmployeeResponsePagedResponse,
  UpdateEmployeeRequest,
} from '../models/index';
import {
    CreateEmployeeRequestFromJSON,
    CreateEmployeeRequestToJSON,
    EmployeeResponseFromJSON,
    EmployeeResponseToJSON,
    EmployeeResponsePagedResponseFromJSON,
    EmployeeResponsePagedResponseToJSON,
    UpdateEmployeeRequestFromJSON,
    UpdateEmployeeRequestToJSON,
} from '../models/index';

export interface ApiEmployeesGetRequest {
    search?: string;
    status?: string;
    employmentType?: string;
    page?: number;
    pageSize?: number;
}

export interface ApiEmployeesIdDeleteRequest {
    id: string;
}

export interface ApiEmployeesIdGetRequest {
    id: string;
}

export interface ApiEmployeesIdPutRequest {
    id: string;
    updateEmployeeRequest?: UpdateEmployeeRequest;
}

export interface ApiEmployeesPostRequest {
    createEmployeeRequest?: CreateEmployeeRequest;
}

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

    /**
     */
    async apiEmployeesGetRaw(requestParameters: ApiEmployeesGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<EmployeeResponsePagedResponse>> {
        const queryParameters: any = {};

        if (requestParameters['search'] != null) {
            queryParameters['search'] = requestParameters['search'];
        }

        if (requestParameters['status'] != null) {
            queryParameters['status'] = requestParameters['status'];
        }

        if (requestParameters['employmentType'] != null) {
            queryParameters['employmentType'] = requestParameters['employmentType'];
        }

        if (requestParameters['page'] != null) {
            queryParameters['page'] = requestParameters['page'];
        }

        if (requestParameters['pageSize'] != null) {
            queryParameters['pageSize'] = requestParameters['pageSize'];
        }

        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/employees`;

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

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

    /**
     */
    async apiEmployeesGet(requestParameters: ApiEmployeesGetRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<EmployeeResponsePagedResponse> {
        const response = await this.apiEmployeesGetRaw(requestParameters, initOverrides);
        return await response.value();
    }

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

        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/employees/{id}`;
        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 apiEmployeesIdDelete(requestParameters: ApiEmployeesIdDeleteRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void> {
        await this.apiEmployeesIdDeleteRaw(requestParameters, initOverrides);
    }

    /**
     */
    async apiEmployeesIdGetRaw(requestParameters: ApiEmployeesIdGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<EmployeeResponse>> {
        if (requestParameters['id'] == null) {
            throw new runtime.RequiredError(
                'id',
                'Required parameter "id" was null or undefined when calling apiEmployeesIdGet().'
            );
        }

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

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

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

    /**
     */
    async apiEmployeesIdGet(requestParameters: ApiEmployeesIdGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<EmployeeResponse> {
        const response = await this.apiEmployeesIdGetRaw(requestParameters, initOverrides);
        return await response.value();
    }

    /**
     */
    async apiEmployeesIdPutRaw(requestParameters: ApiEmployeesIdPutRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<EmployeeResponse>> {
        if (requestParameters['id'] == null) {
            throw new runtime.RequiredError(
                'id',
                'Required parameter "id" was null or undefined when calling apiEmployeesIdPut().'
            );
        }

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

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

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

    /**
     */
    async apiEmployeesIdPut(requestParameters: ApiEmployeesIdPutRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<EmployeeResponse> {
        const response = await this.apiEmployeesIdPutRaw(requestParameters, initOverrides);
        return await response.value();
    }

    /**
     */
    async apiEmployeesPostRaw(requestParameters: ApiEmployeesPostRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<EmployeeResponse>> {
        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/employees`;

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

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

    /**
     */
    async apiEmployeesPost(requestParameters: ApiEmployeesPostRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<EmployeeResponse> {
        const response = await this.apiEmployeesPostRaw(requestParameters, initOverrides);
        return await response.value();
    }

}
