/**
 * 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 {
  CheckListModel,
  CreateCheckListRequest,
  ProblemDetails
} from './client.schemas';

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





export const createCheckList = (
    createCheckListRequest: CreateCheckListRequest,
 signal?: AbortSignal
) => {
      
      
      return customClient<CheckListModel>(
      {url: `/api/checklists`, method: 'POST',
      headers: {'Content-Type': 'application/json', },
      data: createCheckListRequest, signal
    },
      );
    }
  


export const getCreateCheckListMutationOptions = <TError = ProblemDetails,
    TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof createCheckList>>, TError,{data: CreateCheckListRequest}, TContext>, }
): UseMutationOptions<Awaited<ReturnType<typeof createCheckList>>, TError,{data: CreateCheckListRequest}, TContext> => {

const mutationKey = ['createCheckList'];
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 createCheckList>>, {data: CreateCheckListRequest}> = (props) => {
          const {data} = props ?? {};

          return  createCheckList(data,)
        }

        


  return  { mutationFn, ...mutationOptions }}

    export type CreateCheckListMutationResult = NonNullable<Awaited<ReturnType<typeof createCheckList>>>
    export type CreateCheckListMutationBody = CreateCheckListRequest
    export type CreateCheckListMutationError = ProblemDetails

    export const useCreateCheckList = <TError = ProblemDetails,
    TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof createCheckList>>, TError,{data: CreateCheckListRequest}, TContext>, }
 , queryClient?: QueryClient): UseMutationResult<
        Awaited<ReturnType<typeof createCheckList>>,
        TError,
        {data: CreateCheckListRequest},
        TContext
      > => {

      const mutationOptions = getCreateCheckListMutationOptions(options);

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

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

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

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

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

  

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

      

      

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

export type GetCheckListQueryResult = NonNullable<Awaited<ReturnType<typeof getCheckList>>>
export type GetCheckListQueryError = ProblemDetails


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

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

  const queryOptions = getGetCheckListQueryOptions(id,options)

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

  query.queryKey = queryOptions.queryKey ;

  return query;
}



export const getCheckListByAlarmScope = (
    alarmScopeId: string,
 signal?: AbortSignal
) => {
      
      
      return customClient<CheckListModel>(
      {url: `/api/checklists/by-alarm-scope/${alarmScopeId}`, method: 'GET', signal
    },
      );
    }
  

export const getGetCheckListByAlarmScopeQueryKey = (alarmScopeId: string,) => {
    return [`/api/checklists/by-alarm-scope/${alarmScopeId}`] as const;
    }

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

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

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

  

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

      

      

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

export type GetCheckListByAlarmScopeQueryResult = NonNullable<Awaited<ReturnType<typeof getCheckListByAlarmScope>>>
export type GetCheckListByAlarmScopeQueryError = ProblemDetails


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

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

  const queryOptions = getGetCheckListByAlarmScopeQueryOptions(alarmScopeId,options)

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

  query.queryKey = queryOptions.queryKey ;

  return query;
}



export const checkCheckListItem = (
    itemId: string,
 ) => {
      
      
      return customClient<void>(
      {url: `/api/checklists/items/${itemId}/check`, method: 'PUT'
    },
      );
    }
  


export const getCheckCheckListItemMutationOptions = <TError = ProblemDetails,
    TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof checkCheckListItem>>, TError,{itemId: string}, TContext>, }
): UseMutationOptions<Awaited<ReturnType<typeof checkCheckListItem>>, TError,{itemId: string}, TContext> => {

const mutationKey = ['checkCheckListItem'];
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 checkCheckListItem>>, {itemId: string}> = (props) => {
          const {itemId} = props ?? {};

          return  checkCheckListItem(itemId,)
        }

        


  return  { mutationFn, ...mutationOptions }}

    export type CheckCheckListItemMutationResult = NonNullable<Awaited<ReturnType<typeof checkCheckListItem>>>
    
    export type CheckCheckListItemMutationError = ProblemDetails

    export const useCheckCheckListItem = <TError = ProblemDetails,
    TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof checkCheckListItem>>, TError,{itemId: string}, TContext>, }
 , queryClient?: QueryClient): UseMutationResult<
        Awaited<ReturnType<typeof checkCheckListItem>>,
        TError,
        {itemId: string},
        TContext
      > => {

      const mutationOptions = getCheckCheckListItemMutationOptions(options);

      return useMutation(mutationOptions , queryClient);
    }
    export const uncheckCheckListItem = (
    itemId: string,
 ) => {
      
      
      return customClient<void>(
      {url: `/api/checklists/items/${itemId}/uncheck`, method: 'PUT'
    },
      );
    }
  


export const getUncheckCheckListItemMutationOptions = <TError = ProblemDetails,
    TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof uncheckCheckListItem>>, TError,{itemId: string}, TContext>, }
): UseMutationOptions<Awaited<ReturnType<typeof uncheckCheckListItem>>, TError,{itemId: string}, TContext> => {

const mutationKey = ['uncheckCheckListItem'];
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 uncheckCheckListItem>>, {itemId: string}> = (props) => {
          const {itemId} = props ?? {};

          return  uncheckCheckListItem(itemId,)
        }

        


  return  { mutationFn, ...mutationOptions }}

    export type UncheckCheckListItemMutationResult = NonNullable<Awaited<ReturnType<typeof uncheckCheckListItem>>>
    
    export type UncheckCheckListItemMutationError = ProblemDetails

    export const useUncheckCheckListItem = <TError = ProblemDetails,
    TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof uncheckCheckListItem>>, TError,{itemId: string}, TContext>, }
 , queryClient?: QueryClient): UseMutationResult<
        Awaited<ReturnType<typeof uncheckCheckListItem>>,
        TError,
        {itemId: string},
        TContext
      > => {

      const mutationOptions = getUncheckCheckListItemMutationOptions(options);

      return useMutation(mutationOptions , queryClient);
    }
    