/* tslint:disable */
/* eslint-disable */
/**
 * authentik
 * Making authentication simple.
 *
 * The version of the OpenAPI document: 2026.5.0-rc1
 * Contact: hello@goauthentik.io
 *
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 * https://openapi-generator.tech
 * Do not edit the class manually.
 */

import type { DataExport, PaginatedDataExportList } from "../models/index";
import { DataExportFromJSON, PaginatedDataExportListFromJSON } from "../models/index";
import * as runtime from "../runtime";

export interface ReportsExportsDestroyRequest {
    id: string;
}

export interface ReportsExportsListRequest {
    ordering?: string;
    page?: number;
    pageSize?: number;
    search?: string;
}

export interface ReportsExportsRetrieveRequest {
    id: string;
}

/**
 *
 */
export class ReportsApi extends runtime.BaseAPI {
    /**
     * Creates request options for reportsExportsDestroy without sending the request
     */
    async reportsExportsDestroyRequestOpts(
        requestParameters: ReportsExportsDestroyRequest,
    ): Promise<runtime.RequestOpts> {
        if (requestParameters["id"] == null) {
            throw new runtime.RequiredError(
                "id",
                'Required parameter "id" was null or undefined when calling reportsExportsDestroy().',
            );
        }

        const queryParameters: any = {};

        const headerParameters: runtime.HTTPHeaders = {};

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

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

        let urlPath = `/reports/exports/{id}/`;
        urlPath = urlPath.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters["id"])));

        return {
            path: urlPath,
            method: "DELETE",
            headers: headerParameters,
            query: queryParameters,
        };
    }

    /**
     */
    async reportsExportsDestroyRaw(
        requestParameters: ReportsExportsDestroyRequest,
        initOverrides?: RequestInit | runtime.InitOverrideFunction,
    ): Promise<runtime.ApiResponse<void>> {
        const requestOptions = await this.reportsExportsDestroyRequestOpts(requestParameters);
        const response = await this.request(requestOptions, initOverrides);

        return new runtime.VoidApiResponse(response);
    }

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

    /**
     * Creates request options for reportsExportsList without sending the request
     */
    async reportsExportsListRequestOpts(
        requestParameters: ReportsExportsListRequest,
    ): Promise<runtime.RequestOpts> {
        const queryParameters: any = {};

        if (requestParameters["ordering"] != null) {
            queryParameters["ordering"] = requestParameters["ordering"];
        }

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

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

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

        const headerParameters: runtime.HTTPHeaders = {};

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

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

        let urlPath = `/reports/exports/`;

        return {
            path: urlPath,
            method: "GET",
            headers: headerParameters,
            query: queryParameters,
        };
    }

    /**
     */
    async reportsExportsListRaw(
        requestParameters: ReportsExportsListRequest,
        initOverrides?: RequestInit | runtime.InitOverrideFunction,
    ): Promise<runtime.ApiResponse<PaginatedDataExportList>> {
        const requestOptions = await this.reportsExportsListRequestOpts(requestParameters);
        const response = await this.request(requestOptions, initOverrides);

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

    /**
     */
    async reportsExportsList(
        requestParameters: ReportsExportsListRequest = {},
        initOverrides?: RequestInit | runtime.InitOverrideFunction,
    ): Promise<PaginatedDataExportList> {
        const response = await this.reportsExportsListRaw(requestParameters, initOverrides);
        return await response.value();
    }

    /**
     * Creates request options for reportsExportsRetrieve without sending the request
     */
    async reportsExportsRetrieveRequestOpts(
        requestParameters: ReportsExportsRetrieveRequest,
    ): Promise<runtime.RequestOpts> {
        if (requestParameters["id"] == null) {
            throw new runtime.RequiredError(
                "id",
                'Required parameter "id" was null or undefined when calling reportsExportsRetrieve().',
            );
        }

        const queryParameters: any = {};

        const headerParameters: runtime.HTTPHeaders = {};

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

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

        let urlPath = `/reports/exports/{id}/`;
        urlPath = urlPath.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters["id"])));

        return {
            path: urlPath,
            method: "GET",
            headers: headerParameters,
            query: queryParameters,
        };
    }

    /**
     */
    async reportsExportsRetrieveRaw(
        requestParameters: ReportsExportsRetrieveRequest,
        initOverrides?: RequestInit | runtime.InitOverrideFunction,
    ): Promise<runtime.ApiResponse<DataExport>> {
        const requestOptions = await this.reportsExportsRetrieveRequestOpts(requestParameters);
        const response = await this.request(requestOptions, initOverrides);

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

    /**
     */
    async reportsExportsRetrieve(
        requestParameters: ReportsExportsRetrieveRequest,
        initOverrides?: RequestInit | runtime.InitOverrideFunction,
    ): Promise<DataExport> {
        const response = await this.reportsExportsRetrieveRaw(requestParameters, initOverrides);
        return await response.value();
    }
}
