// This file is auto-generated by @hey-api/openapi-ts

import { type Client, formDataBodySerializer, type Options as Options2, type TDataShape } from './client';
import { client } from './client.gen';
import type { AddImageToAtlasData, AddImageToAtlasResponses, DeleteAnnotationData, DeleteAnnotationResponses, ExportUserUpdatesData, ExportUserUpdatesResponses, GetAnnotationDetailData, GetAnnotationDetailResponses, GetAnnotationsData, GetAnnotationsResponses, GetAtlasesData, GetAtlasesResponses, GetFormSchemaData, GetFormSchemaResponses, GetModelsData, GetModelsResponses, ImportUserUpdatesData, ImportUserUpdatesResponses, SaveAnnotationData, SaveAnnotationResponses, UploadModelData, UploadModelResponses } from './types.gen';

export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean> = Options2<TData, ThrowOnError> & {
    /**
     * You can provide a client instance returned by `createClient()` instead of
     * individual options. This might be also useful if you want to implement a
     * custom client.
     */
    client?: Client;
    /**
     * You can pass arbitrary values through the `meta` object. This can be
     * used to access values that aren't defined as part of the SDK function.
     */
    meta?: Record<string, unknown>;
};

/**
 * Získá dynamickou strukturu formuláře (včetně uživatelských obrázků)
 */
export const getFormSchema = <ThrowOnError extends boolean = false>(options: Options<GetFormSchemaData, ThrowOnError>) => (options.client ?? client).get<GetFormSchemaResponses, unknown, ThrowOnError>({
    responseType: 'json',
    url: '/api/form-schema',
    ...options
});

/**
 * Získá seznam všech dostupných atlasů
 */
export const getAtlases = <ThrowOnError extends boolean = false>(options?: Options<GetAtlasesData, ThrowOnError>) => (options?.client ?? client).get<GetAtlasesResponses, unknown, ThrowOnError>({
    responseType: 'json',
    url: '/api/atlases',
    ...options
});

/**
 * Přidá jeden konkrétní obrázek k existující variantě v atlasu
 */
export const addImageToAtlas = <ThrowOnError extends boolean = false>(options: Options<AddImageToAtlasData, ThrowOnError>) => (options.client ?? client).post<AddImageToAtlasResponses, unknown, ThrowOnError>({
    ...formDataBodySerializer,
    responseType: 'json',
    url: '/api/atlases/add-image',
    ...options,
    headers: {
        'Content-Type': null,
        ...options.headers
    }
});

/**
 * Vyexportuje všechny uživatelské změny do ZIP balíčku
 */
export const exportUserUpdates = <ThrowOnError extends boolean = false>(options?: Options<ExportUserUpdatesData, ThrowOnError>) => (options?.client ?? client).get<ExportUserUpdatesResponses, unknown, ThrowOnError>({
    responseType: 'blob',
    url: '/api/updates/export',
    ...options
});

/**
 * Importuje ZIP balíček změn od jiného uživatele
 */
export const importUserUpdates = <ThrowOnError extends boolean = false>(options: Options<ImportUserUpdatesData, ThrowOnError>) => (options.client ?? client).post<ImportUserUpdatesResponses, unknown, ThrowOnError>({
    ...formDataBodySerializer,
    responseType: 'json',
    url: '/api/updates/import',
    ...options,
    headers: {
        'Content-Type': null,
        ...options.headers
    }
});

/**
 * Získá seznam všech modelů
 */
export const getModels = <ThrowOnError extends boolean = false>(options?: Options<GetModelsData, ThrowOnError>) => (options?.client ?? client).get<GetModelsResponses, unknown, ThrowOnError>({
    responseType: 'json',
    url: '/api/models',
    ...options
});

/**
 * Nahraje nový model
 */
export const uploadModel = <ThrowOnError extends boolean = false>(options: Options<UploadModelData, ThrowOnError>) => (options.client ?? client).post<UploadModelResponses, unknown, ThrowOnError>({
    ...formDataBodySerializer,
    responseType: 'json',
    url: '/api/models',
    ...options,
    headers: {
        'Content-Type': null,
        ...options.headers
    }
});

/**
 * Získá seznam všech uložených záznamů
 */
export const getAnnotations = <ThrowOnError extends boolean = false>(options?: Options<GetAnnotationsData, ThrowOnError>) => (options?.client ?? client).get<GetAnnotationsResponses, unknown, ThrowOnError>({
    responseType: 'json',
    url: '/annotations',
    ...options
});

/**
 * Uloží nebo aktualizuje anotaci
 */
export const saveAnnotation = <ThrowOnError extends boolean = false>(options: Options<SaveAnnotationData, ThrowOnError>) => (options.client ?? client).post<SaveAnnotationResponses, unknown, ThrowOnError>({
    ...formDataBodySerializer,
    responseType: 'json',
    url: '/annotations',
    ...options,
    headers: {
        'Content-Type': null,
        ...options.headers
    }
});

/**
 * Smaže anotaci
 */
export const deleteAnnotation = <ThrowOnError extends boolean = false>(options: Options<DeleteAnnotationData, ThrowOnError>) => (options.client ?? client).delete<DeleteAnnotationResponses, unknown, ThrowOnError>({ url: '/annotations/{annotationId}', ...options });

/**
 * Získá detail konkrétní anotace
 */
export const getAnnotationDetail = <ThrowOnError extends boolean = false>(options: Options<GetAnnotationDetailData, ThrowOnError>) => (options.client ?? client).get<GetAnnotationDetailResponses, unknown, ThrowOnError>({
    responseType: 'json',
    url: '/annotations/{annotationId}',
    ...options
});
