/**
 * 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 {
  CreateLogRequest,
  GetLogListParams,
  TableDataResponseModelOfUserLogModel,
  UserLogModel
} from './client.schemas';

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





export const getLogList = (
    params?: GetLogListParams,
 signal?: AbortSignal
) => {
      
      
      return customClient<TableDataResponseModelOfUserLogModel>(
      {url: `/api/logs`, method: 'GET',
        params, signal
    },
      );
    }
  

export const getGetLogListQueryKey = (params?: GetLogListParams,) => {
    return [`/api/logs`, ...(params ? [params]: [])] as const;
    }

    
export const getGetLogListQueryOptions = <TData = Awaited<ReturnType<typeof getLogList>>, TError = unknown>(params?: GetLogListParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getLogList>>, TError, TData>>, }
) => {

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

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

  

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

      

      

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

export type GetLogListQueryResult = NonNullable<Awaited<ReturnType<typeof getLogList>>>
export type GetLogListQueryError = unknown


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

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

  const queryOptions = getGetLogListQueryOptions(params,options)

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

  query.queryKey = queryOptions.queryKey ;

  return query;
}



export const createLog = (
    createLogRequest: CreateLogRequest,
 signal?: AbortSignal
) => {
      
      
      return customClient<UserLogModel>(
      {url: `/api/logs`, method: 'POST',
      headers: {'Content-Type': 'application/json', },
      data: createLogRequest, signal
    },
      );
    }
  


export const getCreateLogMutationOptions = <TError = string,
    TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof createLog>>, TError,{data: CreateLogRequest}, TContext>, }
): UseMutationOptions<Awaited<ReturnType<typeof createLog>>, TError,{data: CreateLogRequest}, TContext> => {

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

          return  createLog(data,)
        }

        


  return  { mutationFn, ...mutationOptions }}

    export type CreateLogMutationResult = NonNullable<Awaited<ReturnType<typeof createLog>>>
    export type CreateLogMutationBody = CreateLogRequest
    export type CreateLogMutationError = string

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

      const mutationOptions = getCreateLogMutationOptions(options);

      return useMutation(mutationOptions , queryClient);
    }
    