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

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





export const getUserSettings = (
    
 signal?: AbortSignal
) => {
      
      
      return customClient<UserSettingsModel>(
      {url: `/api/user-settings`, method: 'GET', signal
    },
      );
    }
  

export const getGetUserSettingsQueryKey = () => {
    return [`/api/user-settings`] as const;
    }

    
export const getGetUserSettingsQueryOptions = <TData = Awaited<ReturnType<typeof getUserSettings>>, TError = ProblemDetails>( options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getUserSettings>>, TError, TData>>, }
) => {

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

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

  

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

      

      

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

export type GetUserSettingsQueryResult = NonNullable<Awaited<ReturnType<typeof getUserSettings>>>
export type GetUserSettingsQueryError = ProblemDetails


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

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

  const queryOptions = getGetUserSettingsQueryOptions(options)

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

  query.queryKey = queryOptions.queryKey ;

  return query;
}



export const updateUserSettings = (
    updateUserSettingsRequest: UpdateUserSettingsRequest,
 ) => {
      
      
      return customClient<UserSettingsModel>(
      {url: `/api/user-settings`, method: 'PUT',
      headers: {'Content-Type': 'application/json', },
      data: updateUserSettingsRequest
    },
      );
    }
  


export const getUpdateUserSettingsMutationOptions = <TError = string,
    TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof updateUserSettings>>, TError,{data: UpdateUserSettingsRequest}, TContext>, }
): UseMutationOptions<Awaited<ReturnType<typeof updateUserSettings>>, TError,{data: UpdateUserSettingsRequest}, TContext> => {

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

          return  updateUserSettings(data,)
        }

        


  return  { mutationFn, ...mutationOptions }}

    export type UpdateUserSettingsMutationResult = NonNullable<Awaited<ReturnType<typeof updateUserSettings>>>
    export type UpdateUserSettingsMutationBody = UpdateUserSettingsRequest
    export type UpdateUserSettingsMutationError = string

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

      const mutationOptions = getUpdateUserSettingsMutationOptions(options);

      return useMutation(mutationOptions , queryClient);
    }
    