/**
 * 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 {
  AlarmScopeModel
} from './client.schemas';

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





export const getAlarmScopeList = (
    
 signal?: AbortSignal
) => {
      
      
      return customClient<AlarmScopeModel[]>(
      {url: `/api/alarm-scopes`, method: 'GET', signal
    },
      );
    }
  

export const getGetAlarmScopeListQueryKey = () => {
    return [`/api/alarm-scopes`] as const;
    }

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

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

  const queryKey =  queryOptions?.queryKey ?? getGetAlarmScopeListQueryKey();

  

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

      

      

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

export type GetAlarmScopeListQueryResult = NonNullable<Awaited<ReturnType<typeof getAlarmScopeList>>>
export type GetAlarmScopeListQueryError = string


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

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

  const queryOptions = getGetAlarmScopeListQueryOptions(options)

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

  query.queryKey = queryOptions.queryKey ;

  return query;
}



export const getAlarmScope = (
    assetId: string,
 signal?: AbortSignal
) => {
      
      
      return customClient<AlarmScopeModel>(
      {url: `/api/assets/${assetId}/alarm-scopes`, method: 'GET', signal
    },
      );
    }
  

export const getGetAlarmScopeQueryKey = (assetId: string,) => {
    return [`/api/assets/${assetId}/alarm-scopes`] as const;
    }

    
export const getGetAlarmScopeQueryOptions = <TData = Awaited<ReturnType<typeof getAlarmScope>>, TError = string>(assetId: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getAlarmScope>>, TError, TData>>, }
) => {

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

  const queryKey =  queryOptions?.queryKey ?? getGetAlarmScopeQueryKey(assetId);

  

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

      

      

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

export type GetAlarmScopeQueryResult = NonNullable<Awaited<ReturnType<typeof getAlarmScope>>>
export type GetAlarmScopeQueryError = string


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

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

  const queryOptions = getGetAlarmScopeQueryOptions(assetId,options)

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

  query.queryKey = queryOptions.queryKey ;

  return query;
}



export const getAlarmScopeById = (
    alarmScopeId: string,
 signal?: AbortSignal
) => {
      
      
      return customClient<AlarmScopeModel>(
      {url: `/api/alarm-scopes/${alarmScopeId}`, method: 'GET', signal
    },
      );
    }
  

export const getGetAlarmScopeByIdQueryKey = (alarmScopeId: string,) => {
    return [`/api/alarm-scopes/${alarmScopeId}`] as const;
    }

    
export const getGetAlarmScopeByIdQueryOptions = <TData = Awaited<ReturnType<typeof getAlarmScopeById>>, TError = string>(alarmScopeId: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getAlarmScopeById>>, TError, TData>>, }
) => {

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

  const queryKey =  queryOptions?.queryKey ?? getGetAlarmScopeByIdQueryKey(alarmScopeId);

  

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

      

      

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

export type GetAlarmScopeByIdQueryResult = NonNullable<Awaited<ReturnType<typeof getAlarmScopeById>>>
export type GetAlarmScopeByIdQueryError = string


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

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

  const queryOptions = getGetAlarmScopeByIdQueryOptions(alarmScopeId,options)

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

  query.queryKey = queryOptions.queryKey ;

  return query;
}



