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

import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import type { Observable } from 'rxjs';
import { OpenAPI } from './core/OpenAPI';
import { request as __request } from './core/request';
import type { BootstrapApiBootstrapGetResponse, LoginForAccessTokenApiTokenPostData, LoginForAccessTokenApiTokenPostResponse, LogoutApiLogoutGetResponse, GetUsersApiUsersGetResponse, GetRolesApiRolesGetResponse, GetAclsApiAclsGetResponse, GetCategoriesApiCategoriesGetResponse, GetCategoriesPapiCategoriesPandasGetResponse, ListDataProvidersApiDataProvidersGetResponse, GetModelListApiDataProviderStoreGetData, GetModelListApiDataProviderStoreGetResponse, GetModelValuesApiStoreNameValuesValueGetData, GetModelValuesApiStoreNameValuesValueGetResponse, GetStoresApiStoresGetResponse, GetProjectsApiProjectsGetResponse, GetSurveyMetaApiSurveyMetaGetResponse, GetFeatureInfoApiFeatureInfoStoreIdGetData, GetFeatureInfoApiFeatureInfoStoreIdGetResponse, GetModelInfoApiModelInfoStoreGetData, GetModelInfoApiModelInfoStoreGetResponse, GetPlotParamsApiPlotParamsStoreGetData, GetPlotParamsApiPlotParamsStoreGetResponse, GetActionsApiActionsGetResponse, ExecuteTagActionApiExecTagActionsPostData, ExecuteTagActionApiExecTagActionsPostResponse, GetGeojsonApiGjStoreNameGetData, GetGeojsonApiGjStoreNameGetResponse, GetBasketsApiAdminBasketGetResponse, GetBasketApiAdminBasketNameGetData, GetBasketApiAdminBasketNameGetResponse, UploadBasketFileApiAdminBasketUploadNamePostData, UploadBasketFileApiAdminBasketUploadNamePostResponse, DownloadBasketFileApiAdminBasketDownloadNameFileIdFileNameGetData, DownloadBasketFileApiAdminBasketDownloadNameFileIdFileNameGetResponse, ImportBasketFileApiAdminBasketImportBasketFileIdGetData, ImportBasketFileApiAdminBasketImportBasketFileIdGetResponse, DeleteBasketFileApiAdminBasketDeleteBasketFileIdGetData, DeleteBasketFileApiAdminBasketDeleteBasketFileIdGetResponse, GetGroupsApiDashboardGroupsGetResponse, GetHomeApiDashboardHomeGetResponse, GetDashboardPageApiDashboardPageGroupNameGetData, GetDashboardPageApiDashboardPageGroupNameGetResponse, GetInitDataApiMapInitDataGetResponse, GetBaseStyleApiMapBaseStyleNameGetData, GetBaseStyleApiMapBaseStyleNameGetResponse, GetLayerStyleApiMapLayerStyleStoreGetData, GetLayerStyleApiMapLayerStyleStoreGetResponse, DownloadCsvApiDownloadCsvStoreModelIdValueResampleGetData, DownloadCsvApiDownloadCsvStoreModelIdValueResampleGetResponse, DownloadGeodataApiDownloadGeodataStoresGetData, DownloadGeodataApiDownloadGeodataStoresGetResponse, ExecuteActionApiDownloadPluginNameStoreIdGetData, ExecuteActionApiDownloadPluginNameStoreIdGetResponse } from './types.gen';

@Injectable({
    providedIn: 'root'
})
export class ApiService {
    constructor(public readonly http: HttpClient) { }
    
    /**
     * Bootstrap
     * @returns BootstrapData Successful Response
     * @throws ApiError
     */
    public bootstrapApiBootstrapGet(): Observable<BootstrapApiBootstrapGetResponse> {
        return __request(OpenAPI, this.http, {
            method: 'GET',
            url: '/api/bootstrap',
            errors: {
                404: 'Not found'
            }
        });
    }
    
    /**
     * Login For Access Token
     * @param data The data for the request.
     * @param data.formData
     * @returns Token Successful Response
     * @throws ApiError
     */
    public loginForAccessTokenApiTokenPost(data: LoginForAccessTokenApiTokenPostData): Observable<LoginForAccessTokenApiTokenPostResponse> {
        return __request(OpenAPI, this.http, {
            method: 'POST',
            url: '/api/token',
            formData: data.formData,
            mediaType: 'application/x-www-form-urlencoded',
            errors: {
                404: 'Not found',
                422: 'Validation Error'
            }
        });
    }
    
    /**
     * Logout
     * @returns unknown Successful Response
     * @throws ApiError
     */
    public logoutApiLogoutGet(): Observable<LogoutApiLogoutGetResponse> {
        return __request(OpenAPI, this.http, {
            method: 'GET',
            url: '/api/logout',
            errors: {
                404: 'Not found'
            }
        });
    }
    
    /**
     * Get Users
     * @returns UserRead Successful Response
     * @throws ApiError
     */
    public getUsersApiUsersGet(): Observable<GetUsersApiUsersGetResponse> {
        return __request(OpenAPI, this.http, {
            method: 'GET',
            url: '/api/users',
            errors: {
                404: 'Not found'
            }
        });
    }
    
    /**
     * Get Roles
     * @returns RoleRead Successful Response
     * @throws ApiError
     */
    public getRolesApiRolesGet(): Observable<GetRolesApiRolesGetResponse> {
        return __request(OpenAPI, this.http, {
            method: 'GET',
            url: '/api/roles',
            errors: {
                404: 'Not found'
            }
        });
    }
    
    /**
     * Get Acls
     * New: ACLs returned as UserRoleLink
     * @returns UserRoleLink Successful Response
     * @throws ApiError
     */
    public getAclsApiAclsGet(): Observable<GetAclsApiAclsGetResponse> {
        return __request(OpenAPI, this.http, {
            method: 'GET',
            url: '/api/acls',
            errors: {
                404: 'Not found'
            }
        });
    }
    
    /**
     * Get Categories
     * @returns CategoryRead Successful Response
     * @throws ApiError
     */
    public getCategoriesApiCategoriesGet(): Observable<GetCategoriesApiCategoriesGetResponse> {
        return __request(OpenAPI, this.http, {
            method: 'GET',
            url: '/api/categories',
            errors: {
                404: 'Not found'
            }
        });
    }
    
    /**
     * Get Categories P
     * @returns CategoryRead Successful Response
     * @throws ApiError
     */
    public getCategoriesPApiCategoriesPandasGet(): Observable<GetCategoriesPapiCategoriesPandasGetResponse> {
        return __request(OpenAPI, this.http, {
            method: 'GET',
            url: '/api/categories_pandas',
            errors: {
                404: 'Not found'
            }
        });
    }
    
    /**
     * List Data Providers
     * Return a list of data providers, for use with the api (graphs, etc)
     * :return:
     * @returns DataProvider Successful Response
     * @throws ApiError
     */
    public listDataProvidersApiDataProvidersGet(): Observable<ListDataProvidersApiDataProvidersGetResponse> {
        return __request(OpenAPI, this.http, {
            method: 'GET',
            url: '/api/data-providers',
            errors: {
                404: 'Not found'
            }
        });
    }
    
    /**
     * Get Model List
     * Json REST store API compatible with Flask Potion and Angular
     * Get the list of items (used for making the list of items in measures)
     * Filter only items with at least one measure
     * @param data The data for the request.
     * @param data.store
     * @returns MeasuresItem Successful Response
     * @throws ApiError
     */
    public getModelListApiDataProviderStoreGet(data: GetModelListApiDataProviderStoreGetData): Observable<GetModelListApiDataProviderStoreGetResponse> {
        return __request(OpenAPI, this.http, {
            method: 'GET',
            url: '/api/data-provider/{store}',
            path: {
                store: data.store
            },
            errors: {
                404: 'Not found',
                422: 'Validation Error'
            }
        });
    }
    
    /**
     * Get Model Values
     * Get values
     * @param data The data for the request.
     * @param data.storeName
     * @param data.value
     * @param data.where
     * @param data.resample
     * @returns unknown Successful Response
     * @throws ApiError
     */
    public getModelValuesApiStoreNameValuesValueGet(data: GetModelValuesApiStoreNameValuesValueGetData): Observable<GetModelValuesApiStoreNameValuesValueGetResponse> {
        return __request(OpenAPI, this.http, {
            method: 'GET',
            url: '/api/{store_name}/values/{value}',
            path: {
                store_name: data.storeName,
                value: data.value
            },
            query: {
                where: data.where,
                resample: data.resample
            },
            errors: {
                404: 'Not found',
                422: 'Validation Error'
            }
        });
    }
    
    /**
     * Get Stores
     * @returns Store Successful Response
     * @throws ApiError
     */
    public getStoresApiStoresGet(): Observable<GetStoresApiStoresGetResponse> {
        return __request(OpenAPI, this.http, {
            method: 'GET',
            url: '/api/stores',
            errors: {
                404: 'Not found'
            }
        });
    }
    
    /**
     * Get Projects
     * @returns Project Successful Response
     * @throws ApiError
     */
    public getProjectsApiProjectsGet(): Observable<GetProjectsApiProjectsGetResponse> {
        return __request(OpenAPI, this.http, {
            method: 'GET',
            url: '/api/projects',
            errors: {
                404: 'Not found'
            }
        });
    }
    
    /**
     * Get Survey Meta
     * @returns SurveyMeta Successful Response
     * @throws ApiError
     */
    public getSurveyMetaApiSurveyMetaGet(): Observable<GetSurveyMetaApiSurveyMetaGetResponse> {
        return __request(OpenAPI, this.http, {
            method: 'GET',
            url: '/api/survey_meta',
            errors: {
                404: 'Not found'
            }
        });
    }
    
    /**
     * Get Feature Info
     * @param data The data for the request.
     * @param data.store
     * @param data.id
     * @returns unknown Successful Response
     * @throws ApiError
     */
    public getFeatureInfoApiFeatureInfoStoreIdGet(data: GetFeatureInfoApiFeatureInfoStoreIdGetData): Observable<GetFeatureInfoApiFeatureInfoStoreIdGetResponse> {
        return __request(OpenAPI, this.http, {
            method: 'GET',
            url: '/api/feature-info/{store}/{id}',
            path: {
                store: data.store,
                id: data.id
            },
            errors: {
                404: 'Not found',
                422: 'Validation Error'
            }
        });
    }
    
    /**
     * Get Model Info
     * @param data The data for the request.
     * @param data.store
     * @returns ModelInfo Successful Response
     * @throws ApiError
     */
    public getModelInfoApiModelInfoStoreGet(data: GetModelInfoApiModelInfoStoreGetData): Observable<GetModelInfoApiModelInfoStoreGetResponse> {
        return __request(OpenAPI, this.http, {
            method: 'GET',
            url: '/api/model-info/{store}',
            path: {
                store: data.store
            },
            errors: {
                404: 'Not found',
                422: 'Validation Error'
            }
        });
    }
    
    /**
     * Get Plot Params
     * @param data The data for the request.
     * @param data.store
     * @param data.id
     * @param data.value
     * @returns PlotParams Successful Response
     * @throws ApiError
     */
    public getPlotParamsApiPlotParamsStoreGet(data: GetPlotParamsApiPlotParamsStoreGetData): Observable<GetPlotParamsApiPlotParamsStoreGetResponse> {
        return __request(OpenAPI, this.http, {
            method: 'GET',
            url: '/api/plot-params/{store}',
            path: {
                store: data.store
            },
            query: {
                id: data.id,
                value: data.value
            },
            errors: {
                404: 'Not found',
                422: 'Validation Error'
            }
        });
    }
    
    /**
     * Get Actions
     * @returns ActionsStore Successful Response
     * @throws ApiError
     */
    public getActionsApiActionsGet(): Observable<GetActionsApiActionsGetResponse> {
        return __request(OpenAPI, this.http, {
            method: 'GET',
            url: '/api/actions',
            errors: {
                404: 'Not found'
            }
        });
    }
    
    /**
     * Execute Tag Action
     * @param data The data for the request.
     * @param data.requestBody
     * @returns ActionsResults Successful Response
     * @throws ApiError
     */
    public executeTagActionApiExecTagActionsPost(data: ExecuteTagActionApiExecTagActionsPostData): Observable<ExecuteTagActionApiExecTagActionsPostResponse> {
        return __request(OpenAPI, this.http, {
            method: 'POST',
            url: '/api/execTagActions',
            body: data.requestBody,
            mediaType: 'application/json',
            errors: {
                404: 'Not found',
                422: 'Validation Error'
            }
        });
    }
    
}

@Injectable({
    providedIn: 'root'
})
export class GeoapiService {
    constructor(public readonly http: HttpClient) { }
    
    /**
     * Get Geojson
     * Some REST stores coded manually (route prefixed with "gj": geojson).
     * :param store_name: name of the model
     * :return: json
     * @param data The data for the request.
     * @param data.storeName
     * @param data.ifNoneMatch
     * @param data.simplify
     * @param data.preserveTopology
     * @returns unknown Successful Response
     * @throws ApiError
     */
    public getGeojsonApiGjStoreNameGet(data: GetGeojsonApiGjStoreNameGetData): Observable<GetGeojsonApiGjStoreNameGetResponse> {
        return __request(OpenAPI, this.http, {
            method: 'GET',
            url: '/api/gj/{store_name}',
            path: {
                store_name: data.storeName
            },
            headers: {
                'If-None-Match': data.ifNoneMatch,
                simplify: data.simplify,
                preserveTopology: data.preserveTopology
            },
            errors: {
                404: 'Not found',
                422: 'Validation Error'
            }
        });
    }
    
}

@Injectable({
    providedIn: 'root'
})
export class AdminService {
    constructor(public readonly http: HttpClient) { }
    
    /**
     * Get Baskets
     * @returns BasketNameOnly Successful Response
     * @throws ApiError
     */
    public getBasketsApiAdminBasketGet(): Observable<GetBasketsApiAdminBasketGetResponse> {
        return __request(OpenAPI, this.http, {
            method: 'GET',
            url: '/api/admin/basket',
            errors: {
                404: 'Not found'
            }
        });
    }
    
    /**
     * Get Basket
     * @param data The data for the request.
     * @param data.name
     * @returns AdminBasket Successful Response
     * @throws ApiError
     */
    public getBasketApiAdminBasketNameGet(data: GetBasketApiAdminBasketNameGetData): Observable<GetBasketApiAdminBasketNameGetResponse> {
        return __request(OpenAPI, this.http, {
            method: 'GET',
            url: '/api/admin/basket/{name}',
            path: {
                name: data.name
            },
            errors: {
                404: 'Not found',
                422: 'Validation Error'
            }
        });
    }
    
    /**
     * Upload Basket File
     * @param data The data for the request.
     * @param data.name
     * @param data.formData
     * @param data.projectId
     * @param data.surveyorId
     * @param data.equipmentId
     * @param data.autoImport
     * @returns BasketImportResult Successful Response
     * @throws ApiError
     */
    public uploadBasketFileApiAdminBasketUploadNamePost(data: UploadBasketFileApiAdminBasketUploadNamePostData): Observable<UploadBasketFileApiAdminBasketUploadNamePostResponse> {
        return __request(OpenAPI, this.http, {
            method: 'POST',
            url: '/api/admin/basket/upload/{name}',
            path: {
                name: data.name
            },
            query: {
                project_id: data.projectId,
                surveyor_id: data.surveyorId,
                equipment_id: data.equipmentId,
                auto_import: data.autoImport
            },
            formData: data.formData,
            mediaType: 'multipart/form-data',
            errors: {
                404: 'Not found',
                422: 'Validation Error'
            }
        });
    }
    
    /**
     * Download Basket File
     * @param data The data for the request.
     * @param data.name
     * @param data.fileId
     * @param data.fileName
     * @returns unknown Successful Response
     * @throws ApiError
     */
    public downloadBasketFileApiAdminBasketDownloadNameFileIdFileNameGet(data: DownloadBasketFileApiAdminBasketDownloadNameFileIdFileNameGetData): Observable<DownloadBasketFileApiAdminBasketDownloadNameFileIdFileNameGetResponse> {
        return __request(OpenAPI, this.http, {
            method: 'GET',
            url: '/api/admin/basket/download/{name}/{file_id}/{file_name}',
            path: {
                name: data.name,
                file_id: data.fileId,
                file_name: data.fileName
            },
            errors: {
                404: 'Not found',
                422: 'Validation Error'
            }
        });
    }
    
    /**
     * Import Basket File
     * @param data The data for the request.
     * @param data.basket
     * @param data.fileId
     * @param data.dryRun
     * @returns BasketImportResult Successful Response
     * @throws ApiError
     */
    public importBasketFileApiAdminBasketImportBasketFileIdGet(data: ImportBasketFileApiAdminBasketImportBasketFileIdGetData): Observable<ImportBasketFileApiAdminBasketImportBasketFileIdGetResponse> {
        return __request(OpenAPI, this.http, {
            method: 'GET',
            url: '/api/admin/basket/import/{basket}/{file_id}',
            path: {
                basket: data.basket,
                file_id: data.fileId
            },
            query: {
                dryRun: data.dryRun
            },
            errors: {
                404: 'Not found',
                422: 'Validation Error'
            }
        });
    }
    
    /**
     * Delete Basket File
     * @param data The data for the request.
     * @param data.basket
     * @param data.fileId
     * @returns unknown Successful Response
     * @throws ApiError
     */
    public deleteBasketFileApiAdminBasketDeleteBasketFileIdGet(data: DeleteBasketFileApiAdminBasketDeleteBasketFileIdGetData): Observable<DeleteBasketFileApiAdminBasketDeleteBasketFileIdGetResponse> {
        return __request(OpenAPI, this.http, {
            method: 'GET',
            url: '/api/admin/basket/delete/{basket}/{file_id}',
            path: {
                basket: data.basket,
                file_id: data.fileId
            },
            errors: {
                404: 'Not found',
                422: 'Validation Error'
            }
        });
    }
    
}

@Injectable({
    providedIn: 'root'
})
export class DashboardService {
    constructor(public readonly http: HttpClient) { }
    
    /**
     * Get Groups
     * @returns DashboardGroup Successful Response
     * @throws ApiError
     */
    public getGroupsApiDashboardGroupsGet(): Observable<GetGroupsApiDashboardGroupsGetResponse> {
        return __request(OpenAPI, this.http, {
            method: 'GET',
            url: '/api/dashboard/groups',
            errors: {
                404: 'Not found'
            }
        });
    }
    
    /**
     * Get Home
     * @returns DashboardHome Successful Response
     * @throws ApiError
     */
    public getHomeApiDashboardHomeGet(): Observable<GetHomeApiDashboardHomeGetResponse> {
        return __request(OpenAPI, this.http, {
            method: 'GET',
            url: '/api/dashboard/home',
            errors: {
                404: 'Not found'
            }
        });
    }
    
    /**
     * Get Dashboard Page
     * @param data The data for the request.
     * @param data.group
     * @param data.name
     * @returns Dashboard Successful Response
     * @throws ApiError
     */
    public getDashboardPageApiDashboardPageGroupNameGet(data: GetDashboardPageApiDashboardPageGroupNameGetData): Observable<GetDashboardPageApiDashboardPageGroupNameGetResponse> {
        return __request(OpenAPI, this.http, {
            method: 'GET',
            url: '/api/dashboard/page/{group}/{name}',
            path: {
                group: data.group,
                name: data.name
            },
            errors: {
                404: 'Not found',
                422: 'Validation Error'
            }
        });
    }
    
}

@Injectable({
    providedIn: 'root'
})
export class MapService {
    constructor(public readonly http: HttpClient) { }
    
    /**
     * Get Init Data
     * @returns MapInitData Successful Response
     * @throws ApiError
     */
    public getInitDataApiMapInitDataGet(): Observable<GetInitDataApiMapInitDataGetResponse> {
        return __request(OpenAPI, this.http, {
            method: 'GET',
            url: '/api/map/init-data'
        });
    }
    
    /**
     * Get Base Style
     * @param data The data for the request.
     * @param data.name
     * @returns BaseStyle Successful Response
     * @throws ApiError
     */
    public getBaseStyleApiMapBaseStyleNameGet(data: GetBaseStyleApiMapBaseStyleNameGetData): Observable<GetBaseStyleApiMapBaseStyleNameGetResponse> {
        return __request(OpenAPI, this.http, {
            method: 'GET',
            url: '/api/map/base_style/{name}',
            path: {
                name: data.name
            },
            errors: {
                422: 'Validation Error'
            }
        });
    }
    
    /**
     * Get Layer Style
     * @param data The data for the request.
     * @param data.store
     * @returns unknown Successful Response
     * @throws ApiError
     */
    public getLayerStyleApiMapLayerStyleStoreGet(data: GetLayerStyleApiMapLayerStyleStoreGetData): Observable<GetLayerStyleApiMapLayerStyleStoreGetResponse> {
        return __request(OpenAPI, this.http, {
            method: 'GET',
            url: '/api/map/layer_style/{store}',
            path: {
                store: data.store
            },
            errors: {
                422: 'Validation Error'
            }
        });
    }
    
}

@Injectable({
    providedIn: 'root'
})
export class DownloadService {
    constructor(public readonly http: HttpClient) { }
    
    /**
     * Download Csv
     * @param data The data for the request.
     * @param data.store
     * @param data.modelId
     * @param data.value
     * @param data.resample
     * @returns unknown Successful Response
     * @throws ApiError
     */
    public downloadCsvApiDownloadCsvStoreModelIdValueResampleGet(data: DownloadCsvApiDownloadCsvStoreModelIdValueResampleGetData): Observable<DownloadCsvApiDownloadCsvStoreModelIdValueResampleGetResponse> {
        return __request(OpenAPI, this.http, {
            method: 'GET',
            url: '/api/download/csv/{store}/{model_id}/{value}/{resample}',
            path: {
                store: data.store,
                model_id: data.modelId,
                value: data.value,
                resample: data.resample
            },
            errors: {
                404: 'Not found',
                422: 'Validation Error'
            }
        });
    }
    
    /**
     * Download Geodata
     * @param data The data for the request.
     * @param data.stores
     * @param data.format
     * @param data.reproject
     * @returns unknown Successful Response
     * @throws ApiError
     */
    public downloadGeodataApiDownloadGeodataStoresGet(data: DownloadGeodataApiDownloadGeodataStoresGetData): Observable<DownloadGeodataApiDownloadGeodataStoresGetResponse> {
        return __request(OpenAPI, this.http, {
            method: 'GET',
            url: '/api/download/geodata/{stores}',
            path: {
                stores: data.stores
            },
            query: {
                format: data.format,
                reproject: data.reproject
            },
            errors: {
                404: 'Not found',
                422: 'Validation Error'
            }
        });
    }
    
    /**
     * Execute Action
     * Download the result of an action
     * @param data The data for the request.
     * @param data.name
     * @param data.store
     * @param data.id
     * @returns unknown Successful Response
     * @throws ApiError
     */
    public executeActionApiDownloadPluginNameStoreIdGet(data: ExecuteActionApiDownloadPluginNameStoreIdGetData): Observable<ExecuteActionApiDownloadPluginNameStoreIdGetResponse> {
        return __request(OpenAPI, this.http, {
            method: 'GET',
            url: '/api/download/plugin/{name}/{store}/{id}',
            path: {
                name: data.name,
                store: data.store,
                id: data.id
            },
            errors: {
                404: 'Not found',
                422: 'Validation Error'
            }
        });
    }
    
}