/**
 * 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 {
  CreateRequest2,
  GetTokenListParams,
  ProblemDetails,
  TableDataResponseModelOfTokenModel,
  TokenModel,
  UpdateRequest2
} from './client.schemas';

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





export const getTokenList = (
    params?: GetTokenListParams,
 signal?: AbortSignal
) => {
      
      
      return customClient<TableDataResponseModelOfTokenModel>(
      {url: `/api/tokens`, method: 'GET',
        params, signal
    },
      );
    }
  

export const getGetTokenListQueryKey = (params?: GetTokenListParams,) => {
    return [`/api/tokens`, ...(params ? [params]: [])] as const;
    }

    
export const getGetTokenListQueryOptions = <TData = Awaited<ReturnType<typeof getTokenList>>, TError = unknown>(params?: GetTokenListParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getTokenList>>, TError, TData>>, }
) => {

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

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

  

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

      

      

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

export type GetTokenListQueryResult = NonNullable<Awaited<ReturnType<typeof getTokenList>>>
export type GetTokenListQueryError = unknown


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

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

  const queryOptions = getGetTokenListQueryOptions(params,options)

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

  query.queryKey = queryOptions.queryKey ;

  return query;
}



export const createToken = (
    createRequest2: CreateRequest2,
 signal?: AbortSignal
) => {
      
      
      return customClient<TokenModel>(
      {url: `/api/tokens`, method: 'POST',
      headers: {'Content-Type': 'application/json', },
      data: createRequest2, signal
    },
      );
    }
  


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

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

          return  createToken(data,)
        }

        


  return  { mutationFn, ...mutationOptions }}

    export type CreateTokenMutationResult = NonNullable<Awaited<ReturnType<typeof createToken>>>
    export type CreateTokenMutationBody = CreateRequest2
    export type CreateTokenMutationError = string | ProblemDetails

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

      const mutationOptions = getCreateTokenMutationOptions(options);

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

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

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

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

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

  

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

      

      

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

export type GetTokenQueryResult = NonNullable<Awaited<ReturnType<typeof getToken>>>
export type GetTokenQueryError = string


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

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

  const queryOptions = getGetTokenQueryOptions(id,options)

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

  query.queryKey = queryOptions.queryKey ;

  return query;
}



export const updateToken = (
    id: string,
    updateRequest2: UpdateRequest2,
 ) => {
      
      
      return customClient<void>(
      {url: `/api/tokens/${id}`, method: 'PUT',
      headers: {'Content-Type': 'application/json', },
      data: updateRequest2
    },
      );
    }
  


export const getUpdateTokenMutationOptions = <TError = string,
    TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof updateToken>>, TError,{id: string;data: UpdateRequest2}, TContext>, }
): UseMutationOptions<Awaited<ReturnType<typeof updateToken>>, TError,{id: string;data: UpdateRequest2}, TContext> => {

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

          return  updateToken(id,data,)
        }

        


  return  { mutationFn, ...mutationOptions }}

    export type UpdateTokenMutationResult = NonNullable<Awaited<ReturnType<typeof updateToken>>>
    export type UpdateTokenMutationBody = UpdateRequest2
    export type UpdateTokenMutationError = string

    export const useUpdateToken = <TError = string,
    TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof updateToken>>, TError,{id: string;data: UpdateRequest2}, TContext>, }
 , queryClient?: QueryClient): UseMutationResult<
        Awaited<ReturnType<typeof updateToken>>,
        TError,
        {id: string;data: UpdateRequest2},
        TContext
      > => {

      const mutationOptions = getUpdateTokenMutationOptions(options);

      return useMutation(mutationOptions , queryClient);
    }
    export const deleteToken = (
    id: string,
 ) => {
      
      
      return customClient<void>(
      {url: `/api/tokens/${id}`, method: 'DELETE'
    },
      );
    }
  


export const getDeleteTokenMutationOptions = <TError = string,
    TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteToken>>, TError,{id: string}, TContext>, }
): UseMutationOptions<Awaited<ReturnType<typeof deleteToken>>, TError,{id: string}, TContext> => {

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

          return  deleteToken(id,)
        }

        


  return  { mutationFn, ...mutationOptions }}

    export type DeleteTokenMutationResult = NonNullable<Awaited<ReturnType<typeof deleteToken>>>
    
    export type DeleteTokenMutationError = string

    export const useDeleteToken = <TError = string,
    TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteToken>>, TError,{id: string}, TContext>, }
 , queryClient?: QueryClient): UseMutationResult<
        Awaited<ReturnType<typeof deleteToken>>,
        TError,
        {id: string},
        TContext
      > => {

      const mutationOptions = getDeleteTokenMutationOptions(options);

      return useMutation(mutationOptions , queryClient);
    }
    export const regenerateToken = (
    id: string,
 ) => {
      
      
      return customClient<string>(
      {url: `/api/tokens/${id}/regenerate`, method: 'PUT'
    },
      );
    }
  


export const getRegenerateTokenMutationOptions = <TError = string,
    TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof regenerateToken>>, TError,{id: string}, TContext>, }
): UseMutationOptions<Awaited<ReturnType<typeof regenerateToken>>, TError,{id: string}, TContext> => {

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

          return  regenerateToken(id,)
        }

        


  return  { mutationFn, ...mutationOptions }}

    export type RegenerateTokenMutationResult = NonNullable<Awaited<ReturnType<typeof regenerateToken>>>
    
    export type RegenerateTokenMutationError = string

    export const useRegenerateToken = <TError = string,
    TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof regenerateToken>>, TError,{id: string}, TContext>, }
 , queryClient?: QueryClient): UseMutationResult<
        Awaited<ReturnType<typeof regenerateToken>>,
        TError,
        {id: string},
        TContext
      > => {

      const mutationOptions = getRegenerateTokenMutationOptions(options);

      return useMutation(mutationOptions , queryClient);
    }
    