/**
 * 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 {
  CreateRequest3,
  GetMemberListParams,
  MemberModel,
  ProblemDetails,
  TableDataResponseModelOfMemberModel
} from './client.schemas';

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





export const getMemberList = (
    params?: GetMemberListParams,
 signal?: AbortSignal
) => {
      
      
      return customClient<TableDataResponseModelOfMemberModel>(
      {url: `/api/members`, method: 'GET',
        params, signal
    },
      );
    }
  

export const getGetMemberListQueryKey = (params?: GetMemberListParams,) => {
    return [`/api/members`, ...(params ? [params]: [])] as const;
    }

    
export const getGetMemberListQueryOptions = <TData = Awaited<ReturnType<typeof getMemberList>>, TError = unknown>(params?: GetMemberListParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getMemberList>>, TError, TData>>, }
) => {

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

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

  

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

      

      

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

export type GetMemberListQueryResult = NonNullable<Awaited<ReturnType<typeof getMemberList>>>
export type GetMemberListQueryError = unknown


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

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

  const queryOptions = getGetMemberListQueryOptions(params,options)

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

  query.queryKey = queryOptions.queryKey ;

  return query;
}



export const createMember = (
    createRequest3: CreateRequest3,
 signal?: AbortSignal
) => {
      
      
      return customClient<MemberModel>(
      {url: `/api/members`, method: 'POST',
      headers: {'Content-Type': 'application/json', },
      data: createRequest3, signal
    },
      );
    }
  


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

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

          return  createMember(data,)
        }

        


  return  { mutationFn, ...mutationOptions }}

    export type CreateMemberMutationResult = NonNullable<Awaited<ReturnType<typeof createMember>>>
    export type CreateMemberMutationBody = CreateRequest3
    export type CreateMemberMutationError = string | ProblemDetails

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

      const mutationOptions = getCreateMemberMutationOptions(options);

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

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

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

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

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

  

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

      

      

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

export type GetMemberQueryResult = NonNullable<Awaited<ReturnType<typeof getMember>>>
export type GetMemberQueryError = string


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

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

  const queryOptions = getGetMemberQueryOptions(id,options)

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

  query.queryKey = queryOptions.queryKey ;

  return query;
}



export const deleteMember = (
    id: string,
 ) => {
      
      
      return customClient<void>(
      {url: `/api/members/${id}`, method: 'DELETE'
    },
      );
    }
  


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

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

          return  deleteMember(id,)
        }

        


  return  { mutationFn, ...mutationOptions }}

    export type DeleteMemberMutationResult = NonNullable<Awaited<ReturnType<typeof deleteMember>>>
    
    export type DeleteMemberMutationError = string

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

      const mutationOptions = getDeleteMemberMutationOptions(options);

      return useMutation(mutationOptions , queryClient);
    }
    