//----------------------
// <auto-generated>
//     Generated using the NSwag toolchain v14.7.1.0 (NJsonSchema v11.6.1.0 (Newtonsoft.Json v13.0.0.0)) (http://NSwag.org)
// </auto-generated>
//----------------------

/* eslint-disable */
// ReSharper disable InconsistentNaming

export class ApiClient {
    private http: { fetch(url: RequestInfo, init?: RequestInit): Promise<Response> };
    private baseUrl: string;
    protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined;

    constructor(baseUrl?: string, http?: { fetch(url: RequestInfo, init?: RequestInit): Promise<Response> }) {
        this.http = http ? http : window as any;
        this.baseUrl = baseUrl ?? "";
    }

    /**
     * @return OK
     */
    health(): Promise<void> {
        let url_ = this.baseUrl + "/health";
        url_ = url_.replace(/[?&]$/, "");

        let options_: RequestInit = {
            method: "GET",
            headers: {
            }
        };

        return this.http.fetch(url_, options_).then((_response: Response) => {
            return this.processHealth(_response);
        });
    }

    protected processHealth(response: Response): Promise<void> {
        const status = response.status;
        let _headers: any = {}; if (response.headers && response.headers.forEach) { response.headers.forEach((v: any, k: any) => _headers[k] = v); };
        if (status === 200) {
            return response.text().then((_responseText) => {
            return;
            });
        } else if (status !== 200 && status !== 204) {
            return response.text().then((_responseText) => {
            return throwException("An unexpected server error occurred.", status, _responseText, _headers);
            });
        }
        return Promise.resolve<void>(null as any);
    }

    /**
     * @return OK
     */
    ready(): Promise<void> {
        let url_ = this.baseUrl + "/health/ready";
        url_ = url_.replace(/[?&]$/, "");

        let options_: RequestInit = {
            method: "GET",
            headers: {
            }
        };

        return this.http.fetch(url_, options_).then((_response: Response) => {
            return this.processReady(_response);
        });
    }

    protected processReady(response: Response): Promise<void> {
        const status = response.status;
        let _headers: any = {}; if (response.headers && response.headers.forEach) { response.headers.forEach((v: any, k: any) => _headers[k] = v); };
        if (status === 200) {
            return response.text().then((_responseText) => {
            return;
            });
        } else if (status !== 200 && status !== 204) {
            return response.text().then((_responseText) => {
            return throwException("An unexpected server error occurred.", status, _responseText, _headers);
            });
        }
        return Promise.resolve<void>(null as any);
    }

    /**
     * @return OK
     */
    dashboardView(): Promise<DashboardViewDto> {
        let url_ = this.baseUrl + "/api/v1/dashboard-view";
        url_ = url_.replace(/[?&]$/, "");

        let options_: RequestInit = {
            method: "GET",
            headers: {
                "Accept": "application/json"
            }
        };

        return this.http.fetch(url_, options_).then((_response: Response) => {
            return this.processDashboardView(_response);
        });
    }

    protected processDashboardView(response: Response): Promise<DashboardViewDto> {
        const status = response.status;
        let _headers: any = {}; if (response.headers && response.headers.forEach) { response.headers.forEach((v: any, k: any) => _headers[k] = v); };
        if (status === 200) {
            return response.text().then((_responseText) => {
            let result200: any = null;
            result200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver) as DashboardViewDto;
            return result200;
            });
        } else if (status !== 200 && status !== 204) {
            return response.text().then((_responseText) => {
            return throwException("An unexpected server error occurred.", status, _responseText, _headers);
            });
        }
        return Promise.resolve<DashboardViewDto>(null as any);
    }

    /**
     * @return OK
     */
    notes(): Promise<AantekeningDto[]> {
        let url_ = this.baseUrl + "/api/v1/notes";
        url_ = url_.replace(/[?&]$/, "");

        let options_: RequestInit = {
            method: "GET",
            headers: {
                "Accept": "application/json"
            }
        };

        return this.http.fetch(url_, options_).then((_response: Response) => {
            return this.processNotes(_response);
        });
    }

    protected processNotes(response: Response): Promise<AantekeningDto[]> {
        const status = response.status;
        let _headers: any = {}; if (response.headers && response.headers.forEach) { response.headers.forEach((v: any, k: any) => _headers[k] = v); };
        if (status === 200) {
            return response.text().then((_responseText) => {
            let result200: any = null;
            result200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver) as AantekeningDto[];
            return result200;
            });
        } else if (status !== 200 && status !== 204) {
            return response.text().then((_responseText) => {
            return throwException("An unexpected server error occurred.", status, _responseText, _headers);
            });
        }
        return Promise.resolve<AantekeningDto[]>(null as any);
    }

    /**
     * @return OK
     */
    address(): Promise<BrpAddressDto> {
        let url_ = this.baseUrl + "/api/v1/brp/address";
        url_ = url_.replace(/[?&]$/, "");

        let options_: RequestInit = {
            method: "GET",
            headers: {
                "Accept": "application/json"
            }
        };

        return this.http.fetch(url_, options_).then((_response: Response) => {
            return this.processAddress(_response);
        });
    }

    protected processAddress(response: Response): Promise<BrpAddressDto> {
        const status = response.status;
        let _headers: any = {}; if (response.headers && response.headers.forEach) { response.headers.forEach((v: any, k: any) => _headers[k] = v); };
        if (status === 200) {
            return response.text().then((_responseText) => {
            let result200: any = null;
            result200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver) as BrpAddressDto;
            return result200;
            });
        } else if (status !== 200 && status !== 204) {
            return response.text().then((_responseText) => {
            return throwException("An unexpected server error occurred.", status, _responseText, _headers);
            });
        }
        return Promise.resolve<BrpAddressDto>(null as any);
    }

    /**
     * @return OK
     */
    diplomas(): Promise<DuoLookupDto> {
        let url_ = this.baseUrl + "/api/v1/duo/diplomas";
        url_ = url_.replace(/[?&]$/, "");

        let options_: RequestInit = {
            method: "GET",
            headers: {
                "Accept": "application/json"
            }
        };

        return this.http.fetch(url_, options_).then((_response: Response) => {
            return this.processDiplomas(_response);
        });
    }

    protected processDiplomas(response: Response): Promise<DuoLookupDto> {
        const status = response.status;
        let _headers: any = {}; if (response.headers && response.headers.forEach) { response.headers.forEach((v: any, k: any) => _headers[k] = v); };
        if (status === 200) {
            return response.text().then((_responseText) => {
            let result200: any = null;
            result200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver) as DuoLookupDto;
            return result200;
            });
        } else if (status !== 200 && status !== 204) {
            return response.text().then((_responseText) => {
            return throwException("An unexpected server error occurred.", status, _responseText, _headers);
            });
        }
        return Promise.resolve<DuoLookupDto>(null as any);
    }

    /**
     * @return OK
     */
    policy(): Promise<IntakePolicyDto> {
        let url_ = this.baseUrl + "/api/v1/intake/policy";
        url_ = url_.replace(/[?&]$/, "");

        let options_: RequestInit = {
            method: "GET",
            headers: {
                "Accept": "application/json"
            }
        };

        return this.http.fetch(url_, options_).then((_response: Response) => {
            return this.processPolicy(_response);
        });
    }

    protected processPolicy(response: Response): Promise<IntakePolicyDto> {
        const status = response.status;
        let _headers: any = {}; if (response.headers && response.headers.forEach) { response.headers.forEach((v: any, k: any) => _headers[k] = v); };
        if (status === 200) {
            return response.text().then((_responseText) => {
            let result200: any = null;
            result200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver) as IntakePolicyDto;
            return result200;
            });
        } else if (status !== 200 && status !== 204) {
            return response.text().then((_responseText) => {
            return throwException("An unexpected server error occurred.", status, _responseText, _headers);
            });
        }
        return Promise.resolve<IntakePolicyDto>(null as any);
    }

    /**
     * @return OK
     */
    registrations(body: RegistratieRequest): Promise<ReferentieResponse> {
        let url_ = this.baseUrl + "/api/v1/registrations";
        url_ = url_.replace(/[?&]$/, "");

        const content_ = JSON.stringify(body);

        let options_: RequestInit = {
            body: content_,
            method: "POST",
            headers: {
                "Content-Type": "application/json",
                "Accept": "application/json"
            }
        };

        return this.http.fetch(url_, options_).then((_response: Response) => {
            return this.processRegistrations(_response);
        });
    }

    protected processRegistrations(response: Response): Promise<ReferentieResponse> {
        const status = response.status;
        let _headers: any = {}; if (response.headers && response.headers.forEach) { response.headers.forEach((v: any, k: any) => _headers[k] = v); };
        if (status === 200) {
            return response.text().then((_responseText) => {
            let result200: any = null;
            result200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver) as ReferentieResponse;
            return result200;
            });
        } else if (status === 422) {
            return response.text().then((_responseText) => {
            let result422: any = null;
            result422 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver) as ProblemDetails;
            return throwException("Unprocessable Content", status, _responseText, _headers, result422);
            });
        } else if (status !== 200 && status !== 204) {
            return response.text().then((_responseText) => {
            return throwException("An unexpected server error occurred.", status, _responseText, _headers);
            });
        }
        return Promise.resolve<ReferentieResponse>(null as any);
    }

    /**
     * @return OK
     */
    herregistraties(body: HerregistratieRequest): Promise<ReferentieResponse> {
        let url_ = this.baseUrl + "/api/v1/herregistraties";
        url_ = url_.replace(/[?&]$/, "");

        const content_ = JSON.stringify(body);

        let options_: RequestInit = {
            body: content_,
            method: "POST",
            headers: {
                "Content-Type": "application/json",
                "Accept": "application/json"
            }
        };

        return this.http.fetch(url_, options_).then((_response: Response) => {
            return this.processHerregistraties(_response);
        });
    }

    protected processHerregistraties(response: Response): Promise<ReferentieResponse> {
        const status = response.status;
        let _headers: any = {}; if (response.headers && response.headers.forEach) { response.headers.forEach((v: any, k: any) => _headers[k] = v); };
        if (status === 200) {
            return response.text().then((_responseText) => {
            let result200: any = null;
            result200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver) as ReferentieResponse;
            return result200;
            });
        } else if (status === 422) {
            return response.text().then((_responseText) => {
            let result422: any = null;
            result422 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver) as ProblemDetails;
            return throwException("Unprocessable Content", status, _responseText, _headers, result422);
            });
        } else if (status !== 200 && status !== 204) {
            return response.text().then((_responseText) => {
            return throwException("An unexpected server error occurred.", status, _responseText, _headers);
            });
        }
        return Promise.resolve<ReferentieResponse>(null as any);
    }

    /**
     * @return OK
     */
    intakes(body: IntakeRequest): Promise<ReferentieResponse> {
        let url_ = this.baseUrl + "/api/v1/intakes";
        url_ = url_.replace(/[?&]$/, "");

        const content_ = JSON.stringify(body);

        let options_: RequestInit = {
            body: content_,
            method: "POST",
            headers: {
                "Content-Type": "application/json",
                "Accept": "application/json"
            }
        };

        return this.http.fetch(url_, options_).then((_response: Response) => {
            return this.processIntakes(_response);
        });
    }

    protected processIntakes(response: Response): Promise<ReferentieResponse> {
        const status = response.status;
        let _headers: any = {}; if (response.headers && response.headers.forEach) { response.headers.forEach((v: any, k: any) => _headers[k] = v); };
        if (status === 200) {
            return response.text().then((_responseText) => {
            let result200: any = null;
            result200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver) as ReferentieResponse;
            return result200;
            });
        } else if (status === 422) {
            return response.text().then((_responseText) => {
            let result422: any = null;
            result422 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver) as ProblemDetails;
            return throwException("Unprocessable Content", status, _responseText, _headers, result422);
            });
        } else if (status !== 200 && status !== 204) {
            return response.text().then((_responseText) => {
            return throwException("An unexpected server error occurred.", status, _responseText, _headers);
            });
        }
        return Promise.resolve<ReferentieResponse>(null as any);
    }

    /**
     * @return OK
     */
    changeRequests(body: ChangeRequestRequest): Promise<ReferentieResponse> {
        let url_ = this.baseUrl + "/api/v1/change-requests";
        url_ = url_.replace(/[?&]$/, "");

        const content_ = JSON.stringify(body);

        let options_: RequestInit = {
            body: content_,
            method: "POST",
            headers: {
                "Content-Type": "application/json",
                "Accept": "application/json"
            }
        };

        return this.http.fetch(url_, options_).then((_response: Response) => {
            return this.processChangeRequests(_response);
        });
    }

    protected processChangeRequests(response: Response): Promise<ReferentieResponse> {
        const status = response.status;
        let _headers: any = {}; if (response.headers && response.headers.forEach) { response.headers.forEach((v: any, k: any) => _headers[k] = v); };
        if (status === 200) {
            return response.text().then((_responseText) => {
            let result200: any = null;
            result200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver) as ReferentieResponse;
            return result200;
            });
        } else if (status === 422) {
            return response.text().then((_responseText) => {
            let result422: any = null;
            result422 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver) as ProblemDetails;
            return throwException("Unprocessable Content", status, _responseText, _headers, result422);
            });
        } else if (status !== 200 && status !== 204) {
            return response.text().then((_responseText) => {
            return throwException("An unexpected server error occurred.", status, _responseText, _headers);
            });
        }
        return Promise.resolve<ReferentieResponse>(null as any);
    }

    /**
     * @param diplomaHerkomst (optional) 
     * @param taalvaardigheid (optional) 
     * @return OK
     */
    categories(wizardId: string, diplomaHerkomst?: string | undefined, taalvaardigheid?: string | undefined): Promise<UploadCategoriesDto> {
        let url_ = this.baseUrl + "/api/v1/uploads/categories?";
        if (wizardId === undefined || wizardId === null)
            throw new globalThis.Error("The parameter 'wizardId' must be defined and cannot be null.");
        else
            url_ += "wizardId=" + encodeURIComponent("" + wizardId) + "&";
        if (diplomaHerkomst === null)
            throw new globalThis.Error("The parameter 'diplomaHerkomst' cannot be null.");
        else if (diplomaHerkomst !== undefined)
            url_ += "diplomaHerkomst=" + encodeURIComponent("" + diplomaHerkomst) + "&";
        if (taalvaardigheid === null)
            throw new globalThis.Error("The parameter 'taalvaardigheid' cannot be null.");
        else if (taalvaardigheid !== undefined)
            url_ += "taalvaardigheid=" + encodeURIComponent("" + taalvaardigheid) + "&";
        url_ = url_.replace(/[?&]$/, "");

        let options_: RequestInit = {
            method: "GET",
            headers: {
                "Accept": "application/json"
            }
        };

        return this.http.fetch(url_, options_).then((_response: Response) => {
            return this.processCategories(_response);
        });
    }

    protected processCategories(response: Response): Promise<UploadCategoriesDto> {
        const status = response.status;
        let _headers: any = {}; if (response.headers && response.headers.forEach) { response.headers.forEach((v: any, k: any) => _headers[k] = v); };
        if (status === 200) {
            return response.text().then((_responseText) => {
            let result200: any = null;
            result200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver) as UploadCategoriesDto;
            return result200;
            });
        } else if (status !== 200 && status !== 204) {
            return response.text().then((_responseText) => {
            return throwException("An unexpected server error occurred.", status, _responseText, _headers);
            });
        }
        return Promise.resolve<UploadCategoriesDto>(null as any);
    }

    /**
     * @return OK
     */
    content(documentId: string): Promise<void> {
        let url_ = this.baseUrl + "/api/v1/uploads/{documentId}/content";
        if (documentId === undefined || documentId === null)
            throw new globalThis.Error("The parameter 'documentId' must be defined.");
        url_ = url_.replace("{documentId}", encodeURIComponent("" + documentId));
        url_ = url_.replace(/[?&]$/, "");

        let options_: RequestInit = {
            method: "GET",
            headers: {
            }
        };

        return this.http.fetch(url_, options_).then((_response: Response) => {
            return this.processContent(_response);
        });
    }

    protected processContent(response: Response): Promise<void> {
        const status = response.status;
        let _headers: any = {}; if (response.headers && response.headers.forEach) { response.headers.forEach((v: any, k: any) => _headers[k] = v); };
        if (status === 200) {
            return response.text().then((_responseText) => {
            return;
            });
        } else if (status === 404) {
            return response.text().then((_responseText) => {
            return throwException("Not Found", status, _responseText, _headers);
            });
        } else if (status !== 200 && status !== 204) {
            return response.text().then((_responseText) => {
            return throwException("An unexpected server error occurred.", status, _responseText, _headers);
            });
        }
        return Promise.resolve<void>(null as any);
    }

    /**
     * @param localIds (optional) 
     * @return OK
     */
    status(localIds?: string | undefined): Promise<UploadStatusDto> {
        let url_ = this.baseUrl + "/api/v1/uploads/status?";
        if (localIds === null)
            throw new globalThis.Error("The parameter 'localIds' cannot be null.");
        else if (localIds !== undefined)
            url_ += "localIds=" + encodeURIComponent("" + localIds) + "&";
        url_ = url_.replace(/[?&]$/, "");

        let options_: RequestInit = {
            method: "GET",
            headers: {
                "Accept": "application/json"
            }
        };

        return this.http.fetch(url_, options_).then((_response: Response) => {
            return this.processStatus(_response);
        });
    }

    protected processStatus(response: Response): Promise<UploadStatusDto> {
        const status = response.status;
        let _headers: any = {}; if (response.headers && response.headers.forEach) { response.headers.forEach((v: any, k: any) => _headers[k] = v); };
        if (status === 200) {
            return response.text().then((_responseText) => {
            let result200: any = null;
            result200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver) as UploadStatusDto;
            return result200;
            });
        } else if (status !== 200 && status !== 204) {
            return response.text().then((_responseText) => {
            return throwException("An unexpected server error occurred.", status, _responseText, _headers);
            });
        }
        return Promise.resolve<UploadStatusDto>(null as any);
    }

    /**
     * @return No Content
     */
    uploads(documentId: string): Promise<void> {
        let url_ = this.baseUrl + "/api/v1/uploads/{documentId}";
        if (documentId === undefined || documentId === null)
            throw new globalThis.Error("The parameter 'documentId' must be defined.");
        url_ = url_.replace("{documentId}", encodeURIComponent("" + documentId));
        url_ = url_.replace(/[?&]$/, "");

        let options_: RequestInit = {
            method: "DELETE",
            headers: {
            }
        };

        return this.http.fetch(url_, options_).then((_response: Response) => {
            return this.processUploads(_response);
        });
    }

    protected processUploads(response: Response): Promise<void> {
        const status = response.status;
        let _headers: any = {}; if (response.headers && response.headers.forEach) { response.headers.forEach((v: any, k: any) => _headers[k] = v); };
        if (status === 204) {
            return response.text().then((_responseText) => {
            return;
            });
        } else if (status === 404) {
            return response.text().then((_responseText) => {
            return throwException("Not Found", status, _responseText, _headers);
            });
        } else if (status === 409) {
            return response.text().then((_responseText) => {
            let result409: any = null;
            result409 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver) as ProblemDetails;
            return throwException("Conflict", status, _responseText, _headers, result409);
            });
        } else if (status !== 200 && status !== 204) {
            return response.text().then((_responseText) => {
            return throwException("An unexpected server error occurred.", status, _responseText, _headers);
            });
        }
        return Promise.resolve<void>(null as any);
    }

    /**
     * @return No Content
     */
    uploads2(documentId: string): Promise<void> {
        let url_ = this.baseUrl + "/api/v1/admin/uploads/{documentId}";
        if (documentId === undefined || documentId === null)
            throw new globalThis.Error("The parameter 'documentId' must be defined.");
        url_ = url_.replace("{documentId}", encodeURIComponent("" + documentId));
        url_ = url_.replace(/[?&]$/, "");

        let options_: RequestInit = {
            method: "DELETE",
            headers: {
            }
        };

        return this.http.fetch(url_, options_).then((_response: Response) => {
            return this.processUploads2(_response);
        });
    }

    protected processUploads2(response: Response): Promise<void> {
        const status = response.status;
        let _headers: any = {}; if (response.headers && response.headers.forEach) { response.headers.forEach((v: any, k: any) => _headers[k] = v); };
        if (status === 204) {
            return response.text().then((_responseText) => {
            return;
            });
        } else if (status === 403) {
            return response.text().then((_responseText) => {
            return throwException("Forbidden", status, _responseText, _headers);
            });
        } else if (status === 404) {
            return response.text().then((_responseText) => {
            return throwException("Not Found", status, _responseText, _headers);
            });
        } else if (status !== 200 && status !== 204) {
            return response.text().then((_responseText) => {
            return throwException("An unexpected server error occurred.", status, _responseText, _headers);
            });
        }
        return Promise.resolve<void>(null as any);
    }

    /**
     * @return OK
     */
    applicationsAll(): Promise<ApplicationSummaryDto[]> {
        let url_ = this.baseUrl + "/api/v1/applications";
        url_ = url_.replace(/[?&]$/, "");

        let options_: RequestInit = {
            method: "GET",
            headers: {
                "Accept": "application/json"
            }
        };

        return this.http.fetch(url_, options_).then((_response: Response) => {
            return this.processApplicationsAll(_response);
        });
    }

    protected processApplicationsAll(response: Response): Promise<ApplicationSummaryDto[]> {
        const status = response.status;
        let _headers: any = {}; if (response.headers && response.headers.forEach) { response.headers.forEach((v: any, k: any) => _headers[k] = v); };
        if (status === 200) {
            return response.text().then((_responseText) => {
            let result200: any = null;
            result200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver) as ApplicationSummaryDto[];
            return result200;
            });
        } else if (status !== 200 && status !== 204) {
            return response.text().then((_responseText) => {
            return throwException("An unexpected server error occurred.", status, _responseText, _headers);
            });
        }
        return Promise.resolve<ApplicationSummaryDto[]>(null as any);
    }

    /**
     * @return Created
     */
    applicationsPOST(body: CreateApplicationRequest): Promise<ApplicationDetailDto> {
        let url_ = this.baseUrl + "/api/v1/applications";
        url_ = url_.replace(/[?&]$/, "");

        const content_ = JSON.stringify(body);

        let options_: RequestInit = {
            body: content_,
            method: "POST",
            headers: {
                "Content-Type": "application/json",
                "Accept": "application/json"
            }
        };

        return this.http.fetch(url_, options_).then((_response: Response) => {
            return this.processApplicationsPOST(_response);
        });
    }

    protected processApplicationsPOST(response: Response): Promise<ApplicationDetailDto> {
        const status = response.status;
        let _headers: any = {}; if (response.headers && response.headers.forEach) { response.headers.forEach((v: any, k: any) => _headers[k] = v); };
        if (status === 201) {
            return response.text().then((_responseText) => {
            let result201: any = null;
            result201 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver) as ApplicationDetailDto;
            return result201;
            });
        } else if (status !== 200 && status !== 204) {
            return response.text().then((_responseText) => {
            return throwException("An unexpected server error occurred.", status, _responseText, _headers);
            });
        }
        return Promise.resolve<ApplicationDetailDto>(null as any);
    }

    /**
     * @return OK
     */
    applicationsGET(id: string): Promise<ApplicationDetailDto> {
        let url_ = this.baseUrl + "/api/v1/applications/{id}";
        if (id === undefined || id === null)
            throw new globalThis.Error("The parameter 'id' must be defined.");
        url_ = url_.replace("{id}", encodeURIComponent("" + id));
        url_ = url_.replace(/[?&]$/, "");

        let options_: RequestInit = {
            method: "GET",
            headers: {
                "Accept": "application/json"
            }
        };

        return this.http.fetch(url_, options_).then((_response: Response) => {
            return this.processApplicationsGET(_response);
        });
    }

    protected processApplicationsGET(response: Response): Promise<ApplicationDetailDto> {
        const status = response.status;
        let _headers: any = {}; if (response.headers && response.headers.forEach) { response.headers.forEach((v: any, k: any) => _headers[k] = v); };
        if (status === 200) {
            return response.text().then((_responseText) => {
            let result200: any = null;
            result200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver) as ApplicationDetailDto;
            return result200;
            });
        } else if (status === 404) {
            return response.text().then((_responseText) => {
            return throwException("Not Found", status, _responseText, _headers);
            });
        } else if (status !== 200 && status !== 204) {
            return response.text().then((_responseText) => {
            return throwException("An unexpected server error occurred.", status, _responseText, _headers);
            });
        }
        return Promise.resolve<ApplicationDetailDto>(null as any);
    }

    /**
     * @return No Content
     */
    applicationsPUT(id: string, body: DraftSyncRequest): Promise<void> {
        let url_ = this.baseUrl + "/api/v1/applications/{id}";
        if (id === undefined || id === null)
            throw new globalThis.Error("The parameter 'id' must be defined.");
        url_ = url_.replace("{id}", encodeURIComponent("" + id));
        url_ = url_.replace(/[?&]$/, "");

        const content_ = JSON.stringify(body);

        let options_: RequestInit = {
            body: content_,
            method: "PUT",
            headers: {
                "Content-Type": "application/json",
            }
        };

        return this.http.fetch(url_, options_).then((_response: Response) => {
            return this.processApplicationsPUT(_response);
        });
    }

    protected processApplicationsPUT(response: Response): Promise<void> {
        const status = response.status;
        let _headers: any = {}; if (response.headers && response.headers.forEach) { response.headers.forEach((v: any, k: any) => _headers[k] = v); };
        if (status === 204) {
            return response.text().then((_responseText) => {
            return;
            });
        } else if (status === 404) {
            return response.text().then((_responseText) => {
            return throwException("Not Found", status, _responseText, _headers);
            });
        } else if (status !== 200 && status !== 204) {
            return response.text().then((_responseText) => {
            return throwException("An unexpected server error occurred.", status, _responseText, _headers);
            });
        }
        return Promise.resolve<void>(null as any);
    }

    /**
     * @return No Content
     */
    applicationsDELETE(id: string): Promise<void> {
        let url_ = this.baseUrl + "/api/v1/applications/{id}";
        if (id === undefined || id === null)
            throw new globalThis.Error("The parameter 'id' must be defined.");
        url_ = url_.replace("{id}", encodeURIComponent("" + id));
        url_ = url_.replace(/[?&]$/, "");

        let options_: RequestInit = {
            method: "DELETE",
            headers: {
            }
        };

        return this.http.fetch(url_, options_).then((_response: Response) => {
            return this.processApplicationsDELETE(_response);
        });
    }

    protected processApplicationsDELETE(response: Response): Promise<void> {
        const status = response.status;
        let _headers: any = {}; if (response.headers && response.headers.forEach) { response.headers.forEach((v: any, k: any) => _headers[k] = v); };
        if (status === 204) {
            return response.text().then((_responseText) => {
            return;
            });
        } else if (status === 404) {
            return response.text().then((_responseText) => {
            return throwException("Not Found", status, _responseText, _headers);
            });
        } else if (status === 409) {
            return response.text().then((_responseText) => {
            let result409: any = null;
            result409 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver) as ProblemDetails;
            return throwException("Conflict", status, _responseText, _headers, result409);
            });
        } else if (status !== 200 && status !== 204) {
            return response.text().then((_responseText) => {
            return throwException("An unexpected server error occurred.", status, _responseText, _headers);
            });
        }
        return Promise.resolve<void>(null as any);
    }

    /**
     * @return OK
     */
    submit(id: string, body: SubmitApplicationRequest): Promise<SubmitApplicationResponse> {
        let url_ = this.baseUrl + "/api/v1/applications/{id}/submit";
        if (id === undefined || id === null)
            throw new globalThis.Error("The parameter 'id' must be defined.");
        url_ = url_.replace("{id}", encodeURIComponent("" + id));
        url_ = url_.replace(/[?&]$/, "");

        const content_ = JSON.stringify(body);

        let options_: RequestInit = {
            body: content_,
            method: "POST",
            headers: {
                "Content-Type": "application/json",
                "Accept": "application/json"
            }
        };

        return this.http.fetch(url_, options_).then((_response: Response) => {
            return this.processSubmit(_response);
        });
    }

    protected processSubmit(response: Response): Promise<SubmitApplicationResponse> {
        const status = response.status;
        let _headers: any = {}; if (response.headers && response.headers.forEach) { response.headers.forEach((v: any, k: any) => _headers[k] = v); };
        if (status === 200) {
            return response.text().then((_responseText) => {
            let result200: any = null;
            result200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver) as SubmitApplicationResponse;
            return result200;
            });
        } else if (status === 404) {
            return response.text().then((_responseText) => {
            return throwException("Not Found", status, _responseText, _headers);
            });
        } else if (status === 409) {
            return response.text().then((_responseText) => {
            let result409: any = null;
            result409 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver) as ProblemDetails;
            return throwException("Conflict", status, _responseText, _headers, result409);
            });
        } else if (status !== 200 && status !== 204) {
            return response.text().then((_responseText) => {
            return throwException("An unexpected server error occurred.", status, _responseText, _headers);
            });
        }
        return Promise.resolve<SubmitApplicationResponse>(null as any);
    }

    /**
     * @return OK
     */
    me(): Promise<MeDto> {
        let url_ = this.baseUrl + "/api/v1/me";
        url_ = url_.replace(/[?&]$/, "");

        let options_: RequestInit = {
            method: "GET",
            headers: {
                "Accept": "application/json"
            }
        };

        return this.http.fetch(url_, options_).then((_response: Response) => {
            return this.processMe(_response);
        });
    }

    protected processMe(response: Response): Promise<MeDto> {
        const status = response.status;
        let _headers: any = {}; if (response.headers && response.headers.forEach) { response.headers.forEach((v: any, k: any) => _headers[k] = v); };
        if (status === 200) {
            return response.text().then((_responseText) => {
            let result200: any = null;
            result200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver) as MeDto;
            return result200;
            });
        } else if (status !== 200 && status !== 204) {
            return response.text().then((_responseText) => {
            return throwException("An unexpected server error occurred.", status, _responseText, _headers);
            });
        }
        return Promise.resolve<MeDto>(null as any);
    }

    /**
     * @return OK
     */
    briefGET(): Promise<BriefViewDto> {
        let url_ = this.baseUrl + "/api/v1/brief";
        url_ = url_.replace(/[?&]$/, "");

        let options_: RequestInit = {
            method: "GET",
            headers: {
                "Accept": "application/json"
            }
        };

        return this.http.fetch(url_, options_).then((_response: Response) => {
            return this.processBriefGET(_response);
        });
    }

    protected processBriefGET(response: Response): Promise<BriefViewDto> {
        const status = response.status;
        let _headers: any = {}; if (response.headers && response.headers.forEach) { response.headers.forEach((v: any, k: any) => _headers[k] = v); };
        if (status === 200) {
            return response.text().then((_responseText) => {
            let result200: any = null;
            result200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver) as BriefViewDto;
            return result200;
            });
        } else if (status !== 200 && status !== 204) {
            return response.text().then((_responseText) => {
            return throwException("An unexpected server error occurred.", status, _responseText, _headers);
            });
        }
        return Promise.resolve<BriefViewDto>(null as any);
    }

    /**
     * @return OK
     */
    briefPUT(body: SaveBriefRequest): Promise<BriefViewDto> {
        let url_ = this.baseUrl + "/api/v1/brief";
        url_ = url_.replace(/[?&]$/, "");

        const content_ = JSON.stringify(body);

        let options_: RequestInit = {
            body: content_,
            method: "PUT",
            headers: {
                "Content-Type": "application/json",
                "Accept": "application/json"
            }
        };

        return this.http.fetch(url_, options_).then((_response: Response) => {
            return this.processBriefPUT(_response);
        });
    }

    protected processBriefPUT(response: Response): Promise<BriefViewDto> {
        const status = response.status;
        let _headers: any = {}; if (response.headers && response.headers.forEach) { response.headers.forEach((v: any, k: any) => _headers[k] = v); };
        if (status === 200) {
            return response.text().then((_responseText) => {
            let result200: any = null;
            result200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver) as BriefViewDto;
            return result200;
            });
        } else if (status === 403) {
            return response.text().then((_responseText) => {
            let result403: any = null;
            result403 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver) as ProblemDetails;
            return throwException("Forbidden", status, _responseText, _headers, result403);
            });
        } else if (status === 409) {
            return response.text().then((_responseText) => {
            let result409: any = null;
            result409 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver) as ProblemDetails;
            return throwException("Conflict", status, _responseText, _headers, result409);
            });
        } else if (status !== 200 && status !== 204) {
            return response.text().then((_responseText) => {
            return throwException("An unexpected server error occurred.", status, _responseText, _headers);
            });
        }
        return Promise.resolve<BriefViewDto>(null as any);
    }

    /**
     * @return OK
     */
    briefSubmit(): Promise<BriefViewDto> {
        let url_ = this.baseUrl + "/api/v1/brief/submit";
        url_ = url_.replace(/[?&]$/, "");

        let options_: RequestInit = {
            method: "POST",
            headers: {
                "Accept": "application/json"
            }
        };

        return this.http.fetch(url_, options_).then((_response: Response) => {
            return this.processBriefSubmit(_response);
        });
    }

    protected processBriefSubmit(response: Response): Promise<BriefViewDto> {
        const status = response.status;
        let _headers: any = {}; if (response.headers && response.headers.forEach) { response.headers.forEach((v: any, k: any) => _headers[k] = v); };
        if (status === 200) {
            return response.text().then((_responseText) => {
            let result200: any = null;
            result200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver) as BriefViewDto;
            return result200;
            });
        } else if (status === 403) {
            return response.text().then((_responseText) => {
            let result403: any = null;
            result403 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver) as ProblemDetails;
            return throwException("Forbidden", status, _responseText, _headers, result403);
            });
        } else if (status === 409) {
            return response.text().then((_responseText) => {
            let result409: any = null;
            result409 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver) as ProblemDetails;
            return throwException("Conflict", status, _responseText, _headers, result409);
            });
        } else if (status !== 200 && status !== 204) {
            return response.text().then((_responseText) => {
            return throwException("An unexpected server error occurred.", status, _responseText, _headers);
            });
        }
        return Promise.resolve<BriefViewDto>(null as any);
    }

    /**
     * @return OK
     */
    approve(): Promise<BriefViewDto> {
        let url_ = this.baseUrl + "/api/v1/brief/approve";
        url_ = url_.replace(/[?&]$/, "");

        let options_: RequestInit = {
            method: "POST",
            headers: {
                "Accept": "application/json"
            }
        };

        return this.http.fetch(url_, options_).then((_response: Response) => {
            return this.processApprove(_response);
        });
    }

    protected processApprove(response: Response): Promise<BriefViewDto> {
        const status = response.status;
        let _headers: any = {}; if (response.headers && response.headers.forEach) { response.headers.forEach((v: any, k: any) => _headers[k] = v); };
        if (status === 200) {
            return response.text().then((_responseText) => {
            let result200: any = null;
            result200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver) as BriefViewDto;
            return result200;
            });
        } else if (status === 403) {
            return response.text().then((_responseText) => {
            let result403: any = null;
            result403 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver) as ProblemDetails;
            return throwException("Forbidden", status, _responseText, _headers, result403);
            });
        } else if (status === 409) {
            return response.text().then((_responseText) => {
            let result409: any = null;
            result409 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver) as ProblemDetails;
            return throwException("Conflict", status, _responseText, _headers, result409);
            });
        } else if (status !== 200 && status !== 204) {
            return response.text().then((_responseText) => {
            return throwException("An unexpected server error occurred.", status, _responseText, _headers);
            });
        }
        return Promise.resolve<BriefViewDto>(null as any);
    }

    /**
     * @return OK
     */
    reject(body: RejectBriefRequest): Promise<BriefViewDto> {
        let url_ = this.baseUrl + "/api/v1/brief/reject";
        url_ = url_.replace(/[?&]$/, "");

        const content_ = JSON.stringify(body);

        let options_: RequestInit = {
            body: content_,
            method: "POST",
            headers: {
                "Content-Type": "application/json",
                "Accept": "application/json"
            }
        };

        return this.http.fetch(url_, options_).then((_response: Response) => {
            return this.processReject(_response);
        });
    }

    protected processReject(response: Response): Promise<BriefViewDto> {
        const status = response.status;
        let _headers: any = {}; if (response.headers && response.headers.forEach) { response.headers.forEach((v: any, k: any) => _headers[k] = v); };
        if (status === 200) {
            return response.text().then((_responseText) => {
            let result200: any = null;
            result200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver) as BriefViewDto;
            return result200;
            });
        } else if (status === 403) {
            return response.text().then((_responseText) => {
            let result403: any = null;
            result403 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver) as ProblemDetails;
            return throwException("Forbidden", status, _responseText, _headers, result403);
            });
        } else if (status === 409) {
            return response.text().then((_responseText) => {
            let result409: any = null;
            result409 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver) as ProblemDetails;
            return throwException("Conflict", status, _responseText, _headers, result409);
            });
        } else if (status !== 200 && status !== 204) {
            return response.text().then((_responseText) => {
            return throwException("An unexpected server error occurred.", status, _responseText, _headers);
            });
        }
        return Promise.resolve<BriefViewDto>(null as any);
    }

    /**
     * @return OK
     */
    send(): Promise<BriefViewDto> {
        let url_ = this.baseUrl + "/api/v1/brief/send";
        url_ = url_.replace(/[?&]$/, "");

        let options_: RequestInit = {
            method: "POST",
            headers: {
                "Accept": "application/json"
            }
        };

        return this.http.fetch(url_, options_).then((_response: Response) => {
            return this.processSend(_response);
        });
    }

    protected processSend(response: Response): Promise<BriefViewDto> {
        const status = response.status;
        let _headers: any = {}; if (response.headers && response.headers.forEach) { response.headers.forEach((v: any, k: any) => _headers[k] = v); };
        if (status === 200) {
            return response.text().then((_responseText) => {
            let result200: any = null;
            result200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver) as BriefViewDto;
            return result200;
            });
        } else if (status === 409) {
            return response.text().then((_responseText) => {
            let result409: any = null;
            result409 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver) as ProblemDetails;
            return throwException("Conflict", status, _responseText, _headers, result409);
            });
        } else if (status !== 200 && status !== 204) {
            return response.text().then((_responseText) => {
            return throwException("An unexpected server error occurred.", status, _responseText, _headers);
            });
        }
        return Promise.resolve<BriefViewDto>(null as any);
    }

    /**
     * @return OK
     */
    briefReset(): Promise<BriefViewDto> {
        let url_ = this.baseUrl + "/api/v1/brief/reset";
        url_ = url_.replace(/[?&]$/, "");

        let options_: RequestInit = {
            method: "POST",
            headers: {
                "Accept": "application/json"
            }
        };

        return this.http.fetch(url_, options_).then((_response: Response) => {
            return this.processBriefReset(_response);
        });
    }

    protected processBriefReset(response: Response): Promise<BriefViewDto> {
        const status = response.status;
        let _headers: any = {}; if (response.headers && response.headers.forEach) { response.headers.forEach((v: any, k: any) => _headers[k] = v); };
        if (status === 200) {
            return response.text().then((_responseText) => {
            let result200: any = null;
            result200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver) as BriefViewDto;
            return result200;
            });
        } else if (status !== 200 && status !== 204) {
            return response.text().then((_responseText) => {
            return throwException("An unexpected server error occurred.", status, _responseText, _headers);
            });
        }
        return Promise.resolve<BriefViewDto>(null as any);
    }

    /**
     * @return OK
     */
    orgTemplates(): Promise<SubOrgSummaryDto[]> {
        let url_ = this.baseUrl + "/api/v1/admin/org-templates";
        url_ = url_.replace(/[?&]$/, "");

        let options_: RequestInit = {
            method: "GET",
            headers: {
                "Accept": "application/json"
            }
        };

        return this.http.fetch(url_, options_).then((_response: Response) => {
            return this.processOrgTemplates(_response);
        });
    }

    protected processOrgTemplates(response: Response): Promise<SubOrgSummaryDto[]> {
        const status = response.status;
        let _headers: any = {}; if (response.headers && response.headers.forEach) { response.headers.forEach((v: any, k: any) => _headers[k] = v); };
        if (status === 200) {
            return response.text().then((_responseText) => {
            let result200: any = null;
            result200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver) as SubOrgSummaryDto[];
            return result200;
            });
        } else if (status === 403) {
            return response.text().then((_responseText) => {
            let result403: any = null;
            result403 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver) as ProblemDetails;
            return throwException("Forbidden", status, _responseText, _headers, result403);
            });
        } else if (status !== 200 && status !== 204) {
            return response.text().then((_responseText) => {
            return throwException("An unexpected server error occurred.", status, _responseText, _headers);
            });
        }
        return Promise.resolve<SubOrgSummaryDto[]>(null as any);
    }

    /**
     * @return OK
     */
    orgTemplateGET(subOrgId: string): Promise<OrgTemplateAdminViewDto> {
        let url_ = this.baseUrl + "/api/v1/admin/org-template/{subOrgId}";
        if (subOrgId === undefined || subOrgId === null)
            throw new globalThis.Error("The parameter 'subOrgId' must be defined.");
        url_ = url_.replace("{subOrgId}", encodeURIComponent("" + subOrgId));
        url_ = url_.replace(/[?&]$/, "");

        let options_: RequestInit = {
            method: "GET",
            headers: {
                "Accept": "application/json"
            }
        };

        return this.http.fetch(url_, options_).then((_response: Response) => {
            return this.processOrgTemplateGET(_response);
        });
    }

    protected processOrgTemplateGET(response: Response): Promise<OrgTemplateAdminViewDto> {
        const status = response.status;
        let _headers: any = {}; if (response.headers && response.headers.forEach) { response.headers.forEach((v: any, k: any) => _headers[k] = v); };
        if (status === 200) {
            return response.text().then((_responseText) => {
            let result200: any = null;
            result200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver) as OrgTemplateAdminViewDto;
            return result200;
            });
        } else if (status === 403) {
            return response.text().then((_responseText) => {
            let result403: any = null;
            result403 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver) as ProblemDetails;
            return throwException("Forbidden", status, _responseText, _headers, result403);
            });
        } else if (status === 404) {
            return response.text().then((_responseText) => {
            return throwException("Not Found", status, _responseText, _headers);
            });
        } else if (status !== 200 && status !== 204) {
            return response.text().then((_responseText) => {
            return throwException("An unexpected server error occurred.", status, _responseText, _headers);
            });
        }
        return Promise.resolve<OrgTemplateAdminViewDto>(null as any);
    }

    /**
     * @return OK
     */
    orgTemplatePUT(subOrgId: string, body: SaveOrgTemplateRequest): Promise<OrgTemplateAdminViewDto> {
        let url_ = this.baseUrl + "/api/v1/admin/org-template/{subOrgId}";
        if (subOrgId === undefined || subOrgId === null)
            throw new globalThis.Error("The parameter 'subOrgId' must be defined.");
        url_ = url_.replace("{subOrgId}", encodeURIComponent("" + subOrgId));
        url_ = url_.replace(/[?&]$/, "");

        const content_ = JSON.stringify(body);

        let options_: RequestInit = {
            body: content_,
            method: "PUT",
            headers: {
                "Content-Type": "application/json",
                "Accept": "application/json"
            }
        };

        return this.http.fetch(url_, options_).then((_response: Response) => {
            return this.processOrgTemplatePUT(_response);
        });
    }

    protected processOrgTemplatePUT(response: Response): Promise<OrgTemplateAdminViewDto> {
        const status = response.status;
        let _headers: any = {}; if (response.headers && response.headers.forEach) { response.headers.forEach((v: any, k: any) => _headers[k] = v); };
        if (status === 200) {
            return response.text().then((_responseText) => {
            let result200: any = null;
            result200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver) as OrgTemplateAdminViewDto;
            return result200;
            });
        } else if (status === 400) {
            return response.text().then((_responseText) => {
            let result400: any = null;
            result400 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver) as ProblemDetails;
            return throwException("Bad Request", status, _responseText, _headers, result400);
            });
        } else if (status === 403) {
            return response.text().then((_responseText) => {
            let result403: any = null;
            result403 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver) as ProblemDetails;
            return throwException("Forbidden", status, _responseText, _headers, result403);
            });
        } else if (status === 404) {
            return response.text().then((_responseText) => {
            return throwException("Not Found", status, _responseText, _headers);
            });
        } else if (status !== 200 && status !== 204) {
            return response.text().then((_responseText) => {
            return throwException("An unexpected server error occurred.", status, _responseText, _headers);
            });
        }
        return Promise.resolve<OrgTemplateAdminViewDto>(null as any);
    }

    /**
     * @return OK
     */
    orgTemplatePublish(subOrgId: string): Promise<PublishOrgTemplateResponse> {
        let url_ = this.baseUrl + "/api/v1/admin/org-template/{subOrgId}/publish";
        if (subOrgId === undefined || subOrgId === null)
            throw new globalThis.Error("The parameter 'subOrgId' must be defined.");
        url_ = url_.replace("{subOrgId}", encodeURIComponent("" + subOrgId));
        url_ = url_.replace(/[?&]$/, "");

        let options_: RequestInit = {
            method: "POST",
            headers: {
                "Accept": "application/json"
            }
        };

        return this.http.fetch(url_, options_).then((_response: Response) => {
            return this.processOrgTemplatePublish(_response);
        });
    }

    protected processOrgTemplatePublish(response: Response): Promise<PublishOrgTemplateResponse> {
        const status = response.status;
        let _headers: any = {}; if (response.headers && response.headers.forEach) { response.headers.forEach((v: any, k: any) => _headers[k] = v); };
        if (status === 200) {
            return response.text().then((_responseText) => {
            let result200: any = null;
            result200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver) as PublishOrgTemplateResponse;
            return result200;
            });
        } else if (status === 403) {
            return response.text().then((_responseText) => {
            let result403: any = null;
            result403 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver) as ProblemDetails;
            return throwException("Forbidden", status, _responseText, _headers, result403);
            });
        } else if (status === 404) {
            return response.text().then((_responseText) => {
            return throwException("Not Found", status, _responseText, _headers);
            });
        } else if (status !== 200 && status !== 204) {
            return response.text().then((_responseText) => {
            return throwException("An unexpected server error occurred.", status, _responseText, _headers);
            });
        }
        return Promise.resolve<PublishOrgTemplateResponse>(null as any);
    }

    /**
     * @return OK
     */
    orgTemplateRollback(subOrgId: string, version: number): Promise<OrgTemplateAdminViewDto> {
        let url_ = this.baseUrl + "/api/v1/admin/org-template/{subOrgId}/rollback/{version}";
        if (subOrgId === undefined || subOrgId === null)
            throw new globalThis.Error("The parameter 'subOrgId' must be defined.");
        url_ = url_.replace("{subOrgId}", encodeURIComponent("" + subOrgId));
        if (version === undefined || version === null)
            throw new globalThis.Error("The parameter 'version' must be defined.");
        url_ = url_.replace("{version}", encodeURIComponent("" + version));
        url_ = url_.replace(/[?&]$/, "");

        let options_: RequestInit = {
            method: "POST",
            headers: {
                "Accept": "application/json"
            }
        };

        return this.http.fetch(url_, options_).then((_response: Response) => {
            return this.processOrgTemplateRollback(_response);
        });
    }

    protected processOrgTemplateRollback(response: Response): Promise<OrgTemplateAdminViewDto> {
        const status = response.status;
        let _headers: any = {}; if (response.headers && response.headers.forEach) { response.headers.forEach((v: any, k: any) => _headers[k] = v); };
        if (status === 200) {
            return response.text().then((_responseText) => {
            let result200: any = null;
            result200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver) as OrgTemplateAdminViewDto;
            return result200;
            });
        } else if (status === 403) {
            return response.text().then((_responseText) => {
            let result403: any = null;
            result403 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver) as ProblemDetails;
            return throwException("Forbidden", status, _responseText, _headers, result403);
            });
        } else if (status === 404) {
            return response.text().then((_responseText) => {
            return throwException("Not Found", status, _responseText, _headers);
            });
        } else if (status !== 200 && status !== 204) {
            return response.text().then((_responseText) => {
            return throwException("An unexpected server error occurred.", status, _responseText, _headers);
            });
        }
        return Promise.resolve<OrgTemplateAdminViewDto>(null as any);
    }
}

export interface AantekeningDto {
    type?: string | undefined;
    omschrijving?: string | undefined;
    datum?: string | undefined;
}

export interface AanvraagStatusDto {
    tag?: string | undefined;
    stepIndex?: number | undefined;
    stepCount?: number | undefined;
    referentie?: string | undefined;
    manual?: boolean | undefined;
    reden?: string | undefined;
}

export interface AdresDto {
    straat?: string | undefined;
    postcode?: string | undefined;
    woonplaats?: string | undefined;
}

export interface ApplicationDetailDto {
    id?: string | undefined;
    type?: string | undefined;
    status?: AanvraagStatusDto;
    draft?: any | undefined;
    documentIds?: string[] | undefined;
    createdAt?: string | undefined;
    updatedAt?: string | undefined;
    submittedAt?: string | undefined;
}

export interface ApplicationSummaryDto {
    id?: string | undefined;
    type?: string | undefined;
    status?: AanvraagStatusDto;
    documentIds?: string[] | undefined;
    createdAt?: string | undefined;
    updatedAt?: string | undefined;
    submittedAt?: string | undefined;
}

export interface BriefDecisionsDto {
    canEdit?: boolean;
    canApprove?: boolean;
    canReject?: boolean;
    canSend?: boolean;
}

export interface BriefDto {
    briefId?: string | undefined;
    beroep?: string | undefined;
    templateId?: string | undefined;
    placeholders?: PlaceholderDefDto[] | undefined;
    sections?: LetterSectionDto[] | undefined;
    status?: BriefStatusDto;
    drafterId?: string | undefined;
}

export interface BriefStatusDto {
    tag?: string | undefined;
    submittedBy?: string | undefined;
    submittedAt?: string | undefined;
    approvedBy?: string | undefined;
    approvedAt?: string | undefined;
    rejectedBy?: string | undefined;
    rejectedAt?: string | undefined;
    comments?: string | undefined;
    sentAt?: string | undefined;
}

export interface BriefViewDto {
    brief?: BriefDto;
    availablePassages?: LibraryPassageDto[] | undefined;
    decisions?: BriefDecisionsDto;
    orgTemplate?: OrgTemplateDto;
}

export interface BrpAddressDto {
    gevonden?: boolean;
    adres?: AdresDto;
}

export interface ChangeRequestRequest {
    straat?: string | undefined;
    postcode?: string | undefined;
    woonplaats?: string | undefined;
}

export interface CreateApplicationRequest {
    type?: string | undefined;
}

export interface DashboardViewDto {
    registration?: RegistrationDto;
    person?: PersonDto;
    decisions?: HerregistratieDecisionsDto;
}

export interface DocumentCategoryDto {
    categoryId?: string | undefined;
    label?: string | undefined;
    description?: string | undefined;
    required?: boolean;
    acceptedTypes?: string[] | undefined;
    maxSizeMb?: number;
    multiple?: boolean;
    allowPostDelivery?: boolean;
}

export interface DocumentRefDto {
    categoryId?: string | undefined;
    channel?: string | undefined;
    documentId?: string | undefined;
}

export interface DraftSyncRequest {
    draft?: any;
    stepIndex?: number;
    stepCount?: number;
    documentIds?: string[] | undefined;
}

export interface DuoDiplomaDto {
    id?: string | undefined;
    naam?: string | undefined;
    instelling?: string | undefined;
    jaar?: number;
    beroep?: string | undefined;
    policyQuestions?: PolicyQuestionDto[] | undefined;
}

export interface DuoLookupDto {
    diplomas?: DuoDiplomaDto[] | undefined;
    handmatig?: ManualDiplomaPolicyDto;
}

export interface HerregistratieDecisionsDto {
    eligibleForHerregistratie?: boolean;
    herregistratieReason?: string | undefined;
}

export interface HerregistratieRequest {
    uren?: number;
    documents?: DocumentRefDto[] | undefined;
}

export interface IntakePolicyDto {
    scholingThreshold?: number;
}

export interface IntakeRequest {
    uren?: number;
}

export interface LetterBlockDto {
    type?: string | undefined;
    blockId?: string | undefined;
    content?: RichTextBlockDto;
    sourcePassageId?: string | undefined;
    sourceVersion?: number | undefined;
    edited?: boolean | undefined;
}

export interface LetterSectionDto {
    sectionKey?: string | undefined;
    title?: string | undefined;
    required?: boolean;
    blocks?: LetterBlockDto[] | undefined;
    locked?: boolean;
}

export interface LibraryPassageDto {
    passageId?: string | undefined;
    scope?: string | undefined;
    sectionKey?: string | undefined;
    label?: string | undefined;
    content?: RichTextBlockDto;
    version?: number;
    beroep?: string | undefined;
}

export interface ManualDiplomaPolicyDto {
    beroepen?: string[] | undefined;
    policyQuestions?: PolicyQuestionDto[] | undefined;
}

export interface MarginsDto {
    topMm?: number;
    rightMm?: number;
    bottomMm?: number;
    leftMm?: number;
}

export interface MeDto {
    capabilities?: string[] | undefined;
}

export interface OrgTemplateAdminViewDto {
    draft?: OrgTemplateDto;
    publishedVersion?: number;
    history?: OrgTemplateVersionDto[] | undefined;
    unsentBriefs?: number;
}

export interface OrgTemplateDto {
    subOrgId?: string | undefined;
    orgName?: string | undefined;
    returnAddress?: string | undefined;
    logoDocumentId?: string | undefined;
    footerContact?: string | undefined;
    footerLegal?: string | undefined;
    signatureName?: string | undefined;
    signatureRole?: string | undefined;
    signatureClosing?: string | undefined;
    margins?: MarginsDto;
    version?: number;
}

export interface OrgTemplateVersionDto {
    version?: number;
    publishedAt?: string | undefined;
    template?: OrgTemplateDto;
}

export interface ParagraphDto {
    nodes?: RichTextNodeDto[] | undefined;
    list?: string | undefined;
}

export interface PersonDto {
    naam?: string | undefined;
    geboortedatum?: string | undefined;
    adres?: AdresDto;
}

export interface PlaceholderDefDto {
    key?: string | undefined;
    label?: string | undefined;
    autoResolvable?: boolean;
    fillable?: boolean | undefined;
    deprecated?: boolean | undefined;
}

export interface PolicyQuestionDto {
    id?: string | undefined;
    vraag?: string | undefined;
    type?: string | undefined;
}

export interface ProblemDetails {
    type?: string | undefined;
    title?: string | undefined;
    status?: number | undefined;
    detail?: string | undefined;
    instance?: string | undefined;

    [key: string]: any;
}

export interface PublishOrgTemplateResponse {
    version?: number;
    affectedUnsentBriefs?: number;
}

export interface ReferentieResponse {
    referentie?: string | undefined;
}

export interface RegistratieRequest {
    diplomaHerkomst?: string | undefined;
    documents?: DocumentRefDto[] | undefined;
}

export interface RegistrationDto {
    bigNummer?: string | undefined;
    naam?: string | undefined;
    beroep?: string | undefined;
    registratiedatum?: string | undefined;
    geboortedatum?: string | undefined;
    status?: RegistrationStatusDto;
}

export interface RegistrationStatusDto {
    tag?: string | undefined;
    herregistratieDatum?: string | undefined;
    geschorstTot?: string | undefined;
    reden?: string | undefined;
    doorgehaaldOp?: string | undefined;
}

export interface RejectBriefRequest {
    comments?: string | undefined;
}

export interface RichTextBlockDto {
    paragraphs?: ParagraphDto[] | undefined;
}

export interface RichTextNodeDto {
    type?: string | undefined;
    text?: string | undefined;
    marks?: string[] | undefined;
    key?: string | undefined;
}

export interface SaveBriefRequest {
    sections?: LetterSectionDto[] | undefined;
}

export interface SaveOrgTemplateRequest {
    draft?: OrgTemplateDto;
}

export interface SubOrgSummaryDto {
    subOrgId?: string | undefined;
    orgName?: string | undefined;
    publishedVersion?: number;
}

export interface SubmitApplicationRequest {
    diplomaHerkomst?: string | undefined;
    uren?: number | undefined;
    documents?: DocumentRefDto[] | undefined;
}

export interface SubmitApplicationResponse {
    referentie?: string | undefined;
    status?: AanvraagStatusDto;
}

export interface UploadCategoriesDto {
    categories?: DocumentCategoryDto[] | undefined;
}

export interface UploadStatusDto {
    results?: UploadStatusItemDto[] | undefined;
}

export interface UploadStatusItemDto {
    localId?: string | undefined;
    status?: string | undefined;
    documentId?: string | undefined;
}

export class SwaggerException extends Error {
    override message: string;
    status: number;
    response: string;
    headers: { [key: string]: any; };
    result: any;

    constructor(message: string, status: number, response: string, headers: { [key: string]: any; }, result: any) {
        super();

        this.message = message;
        this.status = status;
        this.response = response;
        this.headers = headers;
        this.result = result;
    }

    protected isSwaggerException = true;

    static isSwaggerException(obj: any): obj is SwaggerException {
        return obj.isSwaggerException === true;
    }
}

function throwException(message: string, status: number, response: string, headers: { [key: string]: any; }, result?: any): any {
    if (result !== null && result !== undefined)
        throw result;
    else
        throw new SwaggerException(message, status, response, headers, null);
}