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

import type {
  GetFaultListParams,
  TableDataResponseModelOfFaultModel
} from './client.schemas';

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





export const getFaultList = (
    params?: GetFaultListParams,
 signal?: AbortSignal
) => {
      
      
      return customClient<TableDataResponseModelOfFaultModel>(
      {url: `/api/faults`, method: 'GET',
        params, signal
    },
      );
    }
  

export const getGetFaultListQueryKey = (params?: GetFaultListParams,) => {
    return [`/api/faults`, ...(params ? [params]: [])] as const;
    }

    
export const getGetFaultListQueryOptions = <TData = Awaited<ReturnType<typeof getFaultList>>, TError = unknown>(params?: GetFaultListParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getFaultList>>, TError, TData>>, }
) => {

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

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

  

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

      

      

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

export type GetFaultListQueryResult = NonNullable<Awaited<ReturnType<typeof getFaultList>>>
export type GetFaultListQueryError = unknown


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

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

  const queryOptions = getGetFaultListQueryOptions(params,options)

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

  query.queryKey = queryOptions.queryKey ;

  return query;
}



