/* 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 {
  AuditEventCategory,
  AuditLogEntryResponsePagedResponse,
} from '../models/index';
import {
    AuditEventCategoryFromJSON,
    AuditEventCategoryToJSON,
    AuditLogEntryResponsePagedResponseFromJSON,
    AuditLogEntryResponsePagedResponseToJSON,
} from '../models/index';

export interface ApiAuditLogGetRequest {
    entityType?: string;
    entityId?: string;
    actorUserId?: string;
    category?: AuditEventCategory;
    fromUtc?: Date;
    toUtc?: Date;
    page?: number;
    pageSize?: number;
}

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

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

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

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

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

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

        if (requestParameters['fromUtc'] != null) {
            queryParameters['fromUtc'] = (requestParameters['fromUtc'] as any).toISOString();
        }

        if (requestParameters['toUtc'] != null) {
            queryParameters['toUtc'] = (requestParameters['toUtc'] as any).toISOString();
        }

        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/audit-log`;

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

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

    /**
     */
    async apiAuditLogGet(requestParameters: ApiAuditLogGetRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AuditLogEntryResponsePagedResponse> {
        const response = await this.apiAuditLogGetRaw(requestParameters, initOverrides);
        return await response.value();
    }

}
