/**
 * 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 {
  CreateDemoEventRequest,
  CreateEventRequest,
  EventModel,
  GetEventListParams,
  ProblemDetails,
  ResetAlarmsRequest,
  TableDataResponseModelOfEventModel
} from './client.schemas';

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





export const createEvent = (
    createEventRequest: CreateEventRequest,
 signal?: AbortSignal
) => {
      
      
      return customClient<EventModel>(
      {url: `/api/events`, method: 'POST',
      headers: {'Content-Type': 'application/json', },
      data: createEventRequest, signal
    },
      );
    }
  


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

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

          return  createEvent(data,)
        }

        


  return  { mutationFn, ...mutationOptions }}

    export type CreateEventMutationResult = NonNullable<Awaited<ReturnType<typeof createEvent>>>
    export type CreateEventMutationBody = CreateEventRequest
    export type CreateEventMutationError = string | ProblemDetails

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

      const mutationOptions = getCreateEventMutationOptions(options);

      return useMutation(mutationOptions , queryClient);
    }
    export const getEventList = (
    params?: GetEventListParams,
 signal?: AbortSignal
) => {
      
      
      return customClient<TableDataResponseModelOfEventModel>(
      {url: `/api/events`, method: 'GET',
        params, signal
    },
      );
    }
  

export const getGetEventListQueryKey = (params?: GetEventListParams,) => {
    return [`/api/events`, ...(params ? [params]: [])] as const;
    }

    
export const getGetEventListQueryOptions = <TData = Awaited<ReturnType<typeof getEventList>>, TError = unknown>(params?: GetEventListParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getEventList>>, TError, TData>>, }
) => {

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

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

  

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

      

      

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

export type GetEventListQueryResult = NonNullable<Awaited<ReturnType<typeof getEventList>>>
export type GetEventListQueryError = unknown


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

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

  const queryOptions = getGetEventListQueryOptions(params,options)

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

  query.queryKey = queryOptions.queryKey ;

  return query;
}



export const resetAlarms = (
    resetAlarmsRequest: ResetAlarmsRequest,
 signal?: AbortSignal
) => {
      
      
      return customClient<void>(
      {url: `/api/events/reset-alarms`, method: 'POST',
      headers: {'Content-Type': 'application/json', },
      data: resetAlarmsRequest, signal
    },
      );
    }
  


export const getResetAlarmsMutationOptions = <TError = string,
    TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof resetAlarms>>, TError,{data: ResetAlarmsRequest}, TContext>, }
): UseMutationOptions<Awaited<ReturnType<typeof resetAlarms>>, TError,{data: ResetAlarmsRequest}, TContext> => {

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

          return  resetAlarms(data,)
        }

        


  return  { mutationFn, ...mutationOptions }}

    export type ResetAlarmsMutationResult = NonNullable<Awaited<ReturnType<typeof resetAlarms>>>
    export type ResetAlarmsMutationBody = ResetAlarmsRequest
    export type ResetAlarmsMutationError = string

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

      const mutationOptions = getResetAlarmsMutationOptions(options);

      return useMutation(mutationOptions , queryClient);
    }
    export const createDemoEvent = (
    createDemoEventRequest: CreateDemoEventRequest,
 signal?: AbortSignal
) => {
      
      
      return customClient<EventModel>(
      {url: `/api/events/demo`, method: 'POST',
      headers: {'Content-Type': 'application/json', },
      data: createDemoEventRequest, signal
    },
      );
    }
  


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

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

          return  createDemoEvent(data,)
        }

        


  return  { mutationFn, ...mutationOptions }}

    export type CreateDemoEventMutationResult = NonNullable<Awaited<ReturnType<typeof createDemoEvent>>>
    export type CreateDemoEventMutationBody = CreateDemoEventRequest
    export type CreateDemoEventMutationError = string | ProblemDetails

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

      const mutationOptions = getCreateDemoEventMutationOptions(options);

      return useMutation(mutationOptions , queryClient);
    }
    