/**
 * Generated by orval v7.10.0 🍺
 * Do not edit manually.
 * Monitoring | v1
 * OpenAPI spec version: 1.0.0
 */
import {
  useMutation,
  useQuery
} from '@tanstack/react-query';
import type {
  DataTag,
  DefinedInitialDataOptions,
  DefinedUseQueryResult,
  MutationFunction,
  QueryClient,
  QueryFunction,
  QueryKey,
  UndefinedInitialDataOptions,
  UseMutationOptions,
  UseMutationResult,
  UseQueryOptions,
  UseQueryResult
} from '@tanstack/react-query';

import type {
  AssetModel,
  CreateAssetRequest,
  GetAssetListParams,
  ProblemDetails,
  TableDataResponseModelOfAssetModel,
  UpdateAssetOnlineStatusRequest,
  UpdateAssetRequest
} from './client.schemas';

import { customClient } from '../services/http.service';





export const getAssetList = (
    params?: GetAssetListParams,
 signal?: AbortSignal
) => {
      
      
      return customClient<TableDataResponseModelOfAssetModel>(
      {url: `/api/assets`, method: 'GET',
        params, signal
    },
      );
    }
  

export const getGetAssetListQueryKey = (params?: GetAssetListParams,) => {
    return [`/api/assets`, ...(params ? [params]: [])] as const;
    }

    
export const getGetAssetListQueryOptions = <TData = Awaited<ReturnType<typeof getAssetList>>, TError = unknown>(params?: GetAssetListParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getAssetList>>, TError, TData>>, }
) => {

const {query: queryOptions} = options ?? {};

  const queryKey =  queryOptions?.queryKey ?? getGetAssetListQueryKey(params);

  

    const queryFn: QueryFunction<Awaited<ReturnType<typeof getAssetList>>> = ({ signal }) => getAssetList(params, signal);

      

      

   return  { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof getAssetList>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }
}

export type GetAssetListQueryResult = NonNullable<Awaited<ReturnType<typeof getAssetList>>>
export type GetAssetListQueryError = unknown


export function useGetAssetList<TData = Awaited<ReturnType<typeof getAssetList>>, TError = unknown>(
 params: undefined |  GetAssetListParams, options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof getAssetList>>, TError, TData>> & Pick<
        DefinedInitialDataOptions<
          Awaited<ReturnType<typeof getAssetList>>,
          TError,
          Awaited<ReturnType<typeof getAssetList>>
        > , 'initialData'
      >, }
 , queryClient?: QueryClient
  ):  DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetAssetList<TData = Awaited<ReturnType<typeof getAssetList>>, TError = unknown>(
 params?: GetAssetListParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getAssetList>>, TError, TData>> & Pick<
        UndefinedInitialDataOptions<
          Awaited<ReturnType<typeof getAssetList>>,
          TError,
          Awaited<ReturnType<typeof getAssetList>>
        > , 'initialData'
      >, }
 , queryClient?: QueryClient
  ):  UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetAssetList<TData = Awaited<ReturnType<typeof getAssetList>>, TError = unknown>(
 params?: GetAssetListParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getAssetList>>, TError, TData>>, }
 , queryClient?: QueryClient
  ):  UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }

export function useGetAssetList<TData = Awaited<ReturnType<typeof getAssetList>>, TError = unknown>(
 params?: GetAssetListParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getAssetList>>, TError, TData>>, }
 , queryClient?: QueryClient 
 ):  UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {

  const queryOptions = getGetAssetListQueryOptions(params,options)

  const query = useQuery(queryOptions , queryClient) as  UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };

  query.queryKey = queryOptions.queryKey ;

  return query;
}



export const createAsset = (
    createAssetRequest: CreateAssetRequest,
 signal?: AbortSignal
) => {
      
      
      return customClient<AssetModel>(
      {url: `/api/assets`, method: 'POST',
      headers: {'Content-Type': 'application/json', },
      data: createAssetRequest, signal
    },
      );
    }
  


export const getCreateAssetMutationOptions = <TError = string | ProblemDetails,
    TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof createAsset>>, TError,{data: CreateAssetRequest}, TContext>, }
): UseMutationOptions<Awaited<ReturnType<typeof createAsset>>, TError,{data: CreateAssetRequest}, TContext> => {

const mutationKey = ['createAsset'];
const {mutation: mutationOptions} = options ?
      options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
      options
      : {...options, mutation: {...options.mutation, mutationKey}}
      : {mutation: { mutationKey, }};

      


      const mutationFn: MutationFunction<Awaited<ReturnType<typeof createAsset>>, {data: CreateAssetRequest}> = (props) => {
          const {data} = props ?? {};

          return  createAsset(data,)
        }

        


  return  { mutationFn, ...mutationOptions }}

    export type CreateAssetMutationResult = NonNullable<Awaited<ReturnType<typeof createAsset>>>
    export type CreateAssetMutationBody = CreateAssetRequest
    export type CreateAssetMutationError = string | ProblemDetails

    export const useCreateAsset = <TError = string | ProblemDetails,
    TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof createAsset>>, TError,{data: CreateAssetRequest}, TContext>, }
 , queryClient?: QueryClient): UseMutationResult<
        Awaited<ReturnType<typeof createAsset>>,
        TError,
        {data: CreateAssetRequest},
        TContext
      > => {

      const mutationOptions = getCreateAssetMutationOptions(options);

      return useMutation(mutationOptions , queryClient);
    }
    export const getAsset = (
    id: string,
 signal?: AbortSignal
) => {
      
      
      return customClient<AssetModel>(
      {url: `/api/assets/${id}`, method: 'GET', signal
    },
      );
    }
  

export const getGetAssetQueryKey = (id: string,) => {
    return [`/api/assets/${id}`] as const;
    }

    
export const getGetAssetQueryOptions = <TData = Awaited<ReturnType<typeof getAsset>>, TError = string>(id: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getAsset>>, TError, TData>>, }
) => {

const {query: queryOptions} = options ?? {};

  const queryKey =  queryOptions?.queryKey ?? getGetAssetQueryKey(id);

  

    const queryFn: QueryFunction<Awaited<ReturnType<typeof getAsset>>> = ({ signal }) => getAsset(id, signal);

      

      

   return  { queryKey, queryFn, enabled: !!(id), ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof getAsset>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }
}

export type GetAssetQueryResult = NonNullable<Awaited<ReturnType<typeof getAsset>>>
export type GetAssetQueryError = string


export function useGetAsset<TData = Awaited<ReturnType<typeof getAsset>>, TError = string>(
 id: string, options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof getAsset>>, TError, TData>> & Pick<
        DefinedInitialDataOptions<
          Awaited<ReturnType<typeof getAsset>>,
          TError,
          Awaited<ReturnType<typeof getAsset>>
        > , 'initialData'
      >, }
 , queryClient?: QueryClient
  ):  DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetAsset<TData = Awaited<ReturnType<typeof getAsset>>, TError = string>(
 id: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getAsset>>, TError, TData>> & Pick<
        UndefinedInitialDataOptions<
          Awaited<ReturnType<typeof getAsset>>,
          TError,
          Awaited<ReturnType<typeof getAsset>>
        > , 'initialData'
      >, }
 , queryClient?: QueryClient
  ):  UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetAsset<TData = Awaited<ReturnType<typeof getAsset>>, TError = string>(
 id: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getAsset>>, TError, TData>>, }
 , queryClient?: QueryClient
  ):  UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }

export function useGetAsset<TData = Awaited<ReturnType<typeof getAsset>>, TError = string>(
 id: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getAsset>>, TError, TData>>, }
 , queryClient?: QueryClient 
 ):  UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {

  const queryOptions = getGetAssetQueryOptions(id,options)

  const query = useQuery(queryOptions , queryClient) as  UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };

  query.queryKey = queryOptions.queryKey ;

  return query;
}



export const updateAsset = (
    id: string,
    updateAssetRequest: UpdateAssetRequest,
 ) => {
      
      
      return customClient<void>(
      {url: `/api/assets/${id}`, method: 'PUT',
      headers: {'Content-Type': 'application/json', },
      data: updateAssetRequest
    },
      );
    }
  


export const getUpdateAssetMutationOptions = <TError = string,
    TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof updateAsset>>, TError,{id: string;data: UpdateAssetRequest}, TContext>, }
): UseMutationOptions<Awaited<ReturnType<typeof updateAsset>>, TError,{id: string;data: UpdateAssetRequest}, TContext> => {

const mutationKey = ['updateAsset'];
const {mutation: mutationOptions} = options ?
      options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
      options
      : {...options, mutation: {...options.mutation, mutationKey}}
      : {mutation: { mutationKey, }};

      


      const mutationFn: MutationFunction<Awaited<ReturnType<typeof updateAsset>>, {id: string;data: UpdateAssetRequest}> = (props) => {
          const {id,data} = props ?? {};

          return  updateAsset(id,data,)
        }

        


  return  { mutationFn, ...mutationOptions }}

    export type UpdateAssetMutationResult = NonNullable<Awaited<ReturnType<typeof updateAsset>>>
    export type UpdateAssetMutationBody = UpdateAssetRequest
    export type UpdateAssetMutationError = string

    export const useUpdateAsset = <TError = string,
    TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof updateAsset>>, TError,{id: string;data: UpdateAssetRequest}, TContext>, }
 , queryClient?: QueryClient): UseMutationResult<
        Awaited<ReturnType<typeof updateAsset>>,
        TError,
        {id: string;data: UpdateAssetRequest},
        TContext
      > => {

      const mutationOptions = getUpdateAssetMutationOptions(options);

      return useMutation(mutationOptions , queryClient);
    }
    export const deleteAsset = (
    id: string,
 ) => {
      
      
      return customClient<void>(
      {url: `/api/assets/${id}`, method: 'DELETE'
    },
      );
    }
  


export const getDeleteAssetMutationOptions = <TError = string,
    TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteAsset>>, TError,{id: string}, TContext>, }
): UseMutationOptions<Awaited<ReturnType<typeof deleteAsset>>, TError,{id: string}, TContext> => {

const mutationKey = ['deleteAsset'];
const {mutation: mutationOptions} = options ?
      options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
      options
      : {...options, mutation: {...options.mutation, mutationKey}}
      : {mutation: { mutationKey, }};

      


      const mutationFn: MutationFunction<Awaited<ReturnType<typeof deleteAsset>>, {id: string}> = (props) => {
          const {id} = props ?? {};

          return  deleteAsset(id,)
        }

        


  return  { mutationFn, ...mutationOptions }}

    export type DeleteAssetMutationResult = NonNullable<Awaited<ReturnType<typeof deleteAsset>>>
    
    export type DeleteAssetMutationError = string

    export const useDeleteAsset = <TError = string,
    TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteAsset>>, TError,{id: string}, TContext>, }
 , queryClient?: QueryClient): UseMutationResult<
        Awaited<ReturnType<typeof deleteAsset>>,
        TError,
        {id: string},
        TContext
      > => {

      const mutationOptions = getDeleteAssetMutationOptions(options);

      return useMutation(mutationOptions , queryClient);
    }
    export const updateAssetOnlineStatus = (
    updateAssetOnlineStatusRequest: UpdateAssetOnlineStatusRequest,
 signal?: AbortSignal
) => {
      
      
      return customClient<void>(
      {url: `/api/assets/online-status`, method: 'POST',
      headers: {'Content-Type': 'application/json', },
      data: updateAssetOnlineStatusRequest, signal
    },
      );
    }
  


export const getUpdateAssetOnlineStatusMutationOptions = <TError = string,
    TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof updateAssetOnlineStatus>>, TError,{data: UpdateAssetOnlineStatusRequest}, TContext>, }
): UseMutationOptions<Awaited<ReturnType<typeof updateAssetOnlineStatus>>, TError,{data: UpdateAssetOnlineStatusRequest}, TContext> => {

const mutationKey = ['updateAssetOnlineStatus'];
const {mutation: mutationOptions} = options ?
      options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
      options
      : {...options, mutation: {...options.mutation, mutationKey}}
      : {mutation: { mutationKey, }};

      


      const mutationFn: MutationFunction<Awaited<ReturnType<typeof updateAssetOnlineStatus>>, {data: UpdateAssetOnlineStatusRequest}> = (props) => {
          const {data} = props ?? {};

          return  updateAssetOnlineStatus(data,)
        }

        


  return  { mutationFn, ...mutationOptions }}

    export type UpdateAssetOnlineStatusMutationResult = NonNullable<Awaited<ReturnType<typeof updateAssetOnlineStatus>>>
    export type UpdateAssetOnlineStatusMutationBody = UpdateAssetOnlineStatusRequest
    export type UpdateAssetOnlineStatusMutationError = string

    export const useUpdateAssetOnlineStatus = <TError = string,
    TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof updateAssetOnlineStatus>>, TError,{data: UpdateAssetOnlineStatusRequest}, TContext>, }
 , queryClient?: QueryClient): UseMutationResult<
        Awaited<ReturnType<typeof updateAssetOnlineStatus>>,
        TError,
        {data: UpdateAssetOnlineStatusRequest},
        TContext
      > => {

      const mutationOptions = getUpdateAssetOnlineStatusMutationOptions(options);

      return useMutation(mutationOptions , queryClient);
    }
    