/**
 * Generated by orval v8.0.0-rc.0 🍺
 * Do not edit manually.
 * Backend Template
 * Coded by Meu TEAM
 * OpenAPI spec version: 1.0.0
 */
import {
  useInfiniteQuery,
  useMutation,
  useQuery
} from '@tanstack/react-query';
import type {
  DataTag,
  DefinedInitialDataOptions,
  DefinedUseInfiniteQueryResult,
  DefinedUseQueryResult,
  InfiniteData,
  MutationFunction,
  QueryClient,
  QueryFunction,
  QueryKey,
  UndefinedInitialDataOptions,
  UseInfiniteQueryOptions,
  UseInfiniteQueryResult,
  UseMutationOptions,
  UseMutationResult,
  UseQueryOptions,
  UseQueryResult
} from '@tanstack/react-query';

import type {
  ContactMutate,
  DeleteContactId200,
  GetContactId200,
  GetContactParams,
  PostContact200,
  PutContactId200,
  ResponseGetAllData
} from '../models';

import { useCustomClient } from '../mutator/custom-client';
import type { ErrorType , BodyType } from '../mutator/custom-client';



type SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];



/**
 * Retrieve a single contact record by its ID
 * @summary Get contact by ID
 */
export type getContactIdResponse200 = {
  data: GetContactId200
  status: 200
}

export type getContactIdResponse404 = {
  data: void
  status: 404
}
    
export type getContactIdResponseSuccess = (getContactIdResponse200) & {
  headers: Headers;
};
export type getContactIdResponseError = (getContactIdResponse404) & {
  headers: Headers;
};

export type getContactIdResponse = (getContactIdResponseSuccess | getContactIdResponseError)

export const getGetContactIdUrl = (id: string,) => {


  

  return `/contact/${id}`
}

export const getContactId = async (id: string, options?: RequestInit): Promise<getContactIdResponse> => {
  
  return useCustomClient<getContactIdResponse>(getGetContactIdUrl(id),
  {      
    ...options,
    method: 'GET'
    
    
  }
);}





export const getGetContactIdInfiniteQueryKey = (id?: string,) => {
    return [
    'infinite', `/contact/${id}`
    ] as const;
    }

export const getGetContactIdQueryKey = (id?: string,) => {
    return [
    `/contact/${id}`
    ] as const;
    }

    
export const getGetContactIdInfiniteQueryOptions = <TData = InfiniteData<Awaited<ReturnType<typeof getContactId>>>, TError = ErrorType<void>>(id: string, options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getContactId>>, TError, TData>>, request?: SecondParameter<typeof useCustomClient>}
) => {

const {query: queryOptions, request: requestOptions} = options ?? {};

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

  

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

      

      

   return  { queryKey, queryFn, enabled: !!(id),  retry: 3, retryDelay: 1000,  ...queryOptions} as UseInfiniteQueryOptions<Awaited<ReturnType<typeof getContactId>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }
}

export type GetContactIdInfiniteQueryResult = NonNullable<Awaited<ReturnType<typeof getContactId>>>
export type GetContactIdInfiniteQueryError = ErrorType<void>


export function useGetContactIdInfinite<TData = InfiniteData<Awaited<ReturnType<typeof getContactId>>>, TError = ErrorType<void>>(
 id: string, options: { query:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getContactId>>, TError, TData>> & Pick<
        DefinedInitialDataOptions<
          Awaited<ReturnType<typeof getContactId>>,
          TError,
          Awaited<ReturnType<typeof getContactId>>
        > , 'initialData'
      >, request?: SecondParameter<typeof useCustomClient>}
 , queryClient?: QueryClient
  ):  DefinedUseInfiniteQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetContactIdInfinite<TData = InfiniteData<Awaited<ReturnType<typeof getContactId>>>, TError = ErrorType<void>>(
 id: string, options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getContactId>>, TError, TData>> & Pick<
        UndefinedInitialDataOptions<
          Awaited<ReturnType<typeof getContactId>>,
          TError,
          Awaited<ReturnType<typeof getContactId>>
        > , 'initialData'
      >, request?: SecondParameter<typeof useCustomClient>}
 , queryClient?: QueryClient
  ):  UseInfiniteQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetContactIdInfinite<TData = InfiniteData<Awaited<ReturnType<typeof getContactId>>>, TError = ErrorType<void>>(
 id: string, options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getContactId>>, TError, TData>>, request?: SecondParameter<typeof useCustomClient>}
 , queryClient?: QueryClient
  ):  UseInfiniteQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
/**
 * @summary Get contact by ID
 */

export function useGetContactIdInfinite<TData = InfiniteData<Awaited<ReturnType<typeof getContactId>>>, TError = ErrorType<void>>(
 id: string, options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getContactId>>, TError, TData>>, request?: SecondParameter<typeof useCustomClient>}
 , queryClient?: QueryClient 
 ):  UseInfiniteQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {

  const queryOptions = getGetContactIdInfiniteQueryOptions(id,options)

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

  query.queryKey = queryOptions.queryKey ;

  return query;
}

/**
 * @summary Get contact by ID
 */
export const prefetchGetContactIdInfiniteQuery = async <TData = Awaited<ReturnType<typeof getContactId>>, TError = ErrorType<void>>(
 queryClient: QueryClient, id: string, options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getContactId>>, TError, TData>>, request?: SecondParameter<typeof useCustomClient>}

  ): Promise<QueryClient> => {

  const queryOptions = getGetContactIdInfiniteQueryOptions(id,options)

  await queryClient.prefetchInfiniteQuery(queryOptions);

  return queryClient;
}



export const getGetContactIdQueryOptions = <TData = Awaited<ReturnType<typeof getContactId>>, TError = ErrorType<void>>(id: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getContactId>>, TError, TData>>, request?: SecondParameter<typeof useCustomClient>}
) => {

const {query: queryOptions, request: requestOptions} = options ?? {};

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

  

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

      

      

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

export type GetContactIdQueryResult = NonNullable<Awaited<ReturnType<typeof getContactId>>>
export type GetContactIdQueryError = ErrorType<void>


export function useGetContactId<TData = Awaited<ReturnType<typeof getContactId>>, TError = ErrorType<void>>(
 id: string, options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof getContactId>>, TError, TData>> & Pick<
        DefinedInitialDataOptions<
          Awaited<ReturnType<typeof getContactId>>,
          TError,
          Awaited<ReturnType<typeof getContactId>>
        > , 'initialData'
      >, request?: SecondParameter<typeof useCustomClient>}
 , queryClient?: QueryClient
  ):  DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetContactId<TData = Awaited<ReturnType<typeof getContactId>>, TError = ErrorType<void>>(
 id: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getContactId>>, TError, TData>> & Pick<
        UndefinedInitialDataOptions<
          Awaited<ReturnType<typeof getContactId>>,
          TError,
          Awaited<ReturnType<typeof getContactId>>
        > , 'initialData'
      >, request?: SecondParameter<typeof useCustomClient>}
 , queryClient?: QueryClient
  ):  UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetContactId<TData = Awaited<ReturnType<typeof getContactId>>, TError = ErrorType<void>>(
 id: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getContactId>>, TError, TData>>, request?: SecondParameter<typeof useCustomClient>}
 , queryClient?: QueryClient
  ):  UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
/**
 * @summary Get contact by ID
 */

export function useGetContactId<TData = Awaited<ReturnType<typeof getContactId>>, TError = ErrorType<void>>(
 id: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getContactId>>, TError, TData>>, request?: SecondParameter<typeof useCustomClient>}
 , queryClient?: QueryClient 
 ):  UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {

  const queryOptions = getGetContactIdQueryOptions(id,options)

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

  query.queryKey = queryOptions.queryKey ;

  return query;
}

/**
 * @summary Get contact by ID
 */
export const prefetchGetContactIdQuery = async <TData = Awaited<ReturnType<typeof getContactId>>, TError = ErrorType<void>>(
 queryClient: QueryClient, id: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getContactId>>, TError, TData>>, request?: SecondParameter<typeof useCustomClient>}

  ): Promise<QueryClient> => {

  const queryOptions = getGetContactIdQueryOptions(id,options)

  await queryClient.prefetchQuery(queryOptions);

  return queryClient;
}



/**
 * Update a single contact record by its ID
 * @summary Update contact by ID
 */
export type putContactIdResponse200 = {
  data: PutContactId200
  status: 200
}

export type putContactIdResponse404 = {
  data: void
  status: 404
}
    
export type putContactIdResponseSuccess = (putContactIdResponse200) & {
  headers: Headers;
};
export type putContactIdResponseError = (putContactIdResponse404) & {
  headers: Headers;
};

export type putContactIdResponse = (putContactIdResponseSuccess | putContactIdResponseError)

export const getPutContactIdUrl = (id: string,) => {


  

  return `/contact/${id}`
}

export const putContactId = async (id: string,
    contactMutate: ContactMutate, options?: RequestInit): Promise<putContactIdResponse> => {
  
  return useCustomClient<putContactIdResponse>(getPutContactIdUrl(id),
  {      
    ...options,
    method: 'PUT',
    headers: { 'Content-Type': 'application/json', ...options?.headers },
    body: JSON.stringify(
      contactMutate,)
  }
);}




export const getPutContactIdMutationOptions = <TError = ErrorType<void>,
    TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof putContactId>>, TError,{id: string;data: BodyType<ContactMutate>}, TContext>, request?: SecondParameter<typeof useCustomClient>}
): UseMutationOptions<Awaited<ReturnType<typeof putContactId>>, TError,{id: string;data: BodyType<ContactMutate>}, TContext> => {

const mutationKey = ['putContactId'];
const {mutation: mutationOptions, request: requestOptions} = options ?
      options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
      options
      : {...options, mutation: {...options.mutation, mutationKey}}
      : {mutation: { mutationKey, }, request: undefined};

      


      const mutationFn: MutationFunction<Awaited<ReturnType<typeof putContactId>>, {id: string;data: BodyType<ContactMutate>}> = (props) => {
          const {id,data} = props ?? {};

          return  putContactId(id,data,requestOptions)
        }

        


  return  { mutationFn, ...mutationOptions }}

    export type PutContactIdMutationResult = NonNullable<Awaited<ReturnType<typeof putContactId>>>
    export type PutContactIdMutationBody = BodyType<ContactMutate>
    export type PutContactIdMutationError = ErrorType<void>

    /**
 * @summary Update contact by ID
 */
export const usePutContactId = <TError = ErrorType<void>,
    TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof putContactId>>, TError,{id: string;data: BodyType<ContactMutate>}, TContext>, request?: SecondParameter<typeof useCustomClient>}
 , queryClient?: QueryClient): UseMutationResult<
        Awaited<ReturnType<typeof putContactId>>,
        TError,
        {id: string;data: BodyType<ContactMutate>},
        TContext
      > => {

      const mutationOptions = getPutContactIdMutationOptions(options);

      return useMutation(mutationOptions, queryClient);
    }
    /**
 * Delete a single contact record by its ID
 * @summary Delete contact by ID
 */
export type deleteContactIdResponse200 = {
  data: DeleteContactId200
  status: 200
}

export type deleteContactIdResponse404 = {
  data: void
  status: 404
}
    
export type deleteContactIdResponseSuccess = (deleteContactIdResponse200) & {
  headers: Headers;
};
export type deleteContactIdResponseError = (deleteContactIdResponse404) & {
  headers: Headers;
};

export type deleteContactIdResponse = (deleteContactIdResponseSuccess | deleteContactIdResponseError)

export const getDeleteContactIdUrl = (id: string,) => {


  

  return `/contact/${id}`
}

export const deleteContactId = async (id: string, options?: RequestInit): Promise<deleteContactIdResponse> => {
  
  return useCustomClient<deleteContactIdResponse>(getDeleteContactIdUrl(id),
  {      
    ...options,
    method: 'DELETE'
    
    
  }
);}




export const getDeleteContactIdMutationOptions = <TError = ErrorType<void>,
    TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteContactId>>, TError,{id: string}, TContext>, request?: SecondParameter<typeof useCustomClient>}
): UseMutationOptions<Awaited<ReturnType<typeof deleteContactId>>, TError,{id: string}, TContext> => {

const mutationKey = ['deleteContactId'];
const {mutation: mutationOptions, request: requestOptions} = options ?
      options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
      options
      : {...options, mutation: {...options.mutation, mutationKey}}
      : {mutation: { mutationKey, }, request: undefined};

      


      const mutationFn: MutationFunction<Awaited<ReturnType<typeof deleteContactId>>, {id: string}> = (props) => {
          const {id} = props ?? {};

          return  deleteContactId(id,requestOptions)
        }

        


  return  { mutationFn, ...mutationOptions }}

    export type DeleteContactIdMutationResult = NonNullable<Awaited<ReturnType<typeof deleteContactId>>>
    
    export type DeleteContactIdMutationError = ErrorType<void>

    /**
 * @summary Delete contact by ID
 */
export const useDeleteContactId = <TError = ErrorType<void>,
    TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteContactId>>, TError,{id: string}, TContext>, request?: SecondParameter<typeof useCustomClient>}
 , queryClient?: QueryClient): UseMutationResult<
        Awaited<ReturnType<typeof deleteContactId>>,
        TError,
        {id: string},
        TContext
      > => {

      const mutationOptions = getDeleteContactIdMutationOptions(options);

      return useMutation(mutationOptions, queryClient);
    }
    /**
 * Retrieve a list of contact with pagination, filtering and sorting
 * @summary Get all contact
 */
export type getContactResponse200 = {
  data: ResponseGetAllData
  status: 200
}
    
export type getContactResponseSuccess = (getContactResponse200) & {
  headers: Headers;
};
;

export type getContactResponse = (getContactResponseSuccess)

export const getGetContactUrl = (params?: GetContactParams,) => {
  const normalizedParams = new URLSearchParams();

  Object.entries(params || {}).forEach(([key, value]) => {
    
    if (value !== undefined) {
      normalizedParams.append(key, value === null ? 'null' : value.toString())
    }
  });

  const stringifiedParams = normalizedParams.toString();

  return stringifiedParams.length > 0 ? `/contact?${stringifiedParams}` : `/contact`
}

export const getContact = async (params?: GetContactParams, options?: RequestInit): Promise<getContactResponse> => {
  
  return useCustomClient<getContactResponse>(getGetContactUrl(params),
  {      
    ...options,
    method: 'GET'
    
    
  }
);}





export const getGetContactInfiniteQueryKey = (params?: GetContactParams,) => {
    return [
    'infinite', `/contact`, ...(params ? [params]: [])
    ] as const;
    }

export const getGetContactQueryKey = (params?: GetContactParams,) => {
    return [
    `/contact`, ...(params ? [params]: [])
    ] as const;
    }

    
export const getGetContactInfiniteQueryOptions = <TData = InfiniteData<Awaited<ReturnType<typeof getContact>>>, TError = ErrorType<unknown>>(params?: GetContactParams, options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getContact>>, TError, TData>>, request?: SecondParameter<typeof useCustomClient>}
) => {

const {query: queryOptions, request: requestOptions} = options ?? {};

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

  

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

      

      

   return  { queryKey, queryFn,   retry: 3, retryDelay: 1000,  ...queryOptions} as UseInfiniteQueryOptions<Awaited<ReturnType<typeof getContact>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }
}

export type GetContactInfiniteQueryResult = NonNullable<Awaited<ReturnType<typeof getContact>>>
export type GetContactInfiniteQueryError = ErrorType<unknown>


export function useGetContactInfinite<TData = InfiniteData<Awaited<ReturnType<typeof getContact>>>, TError = ErrorType<unknown>>(
 params: undefined |  GetContactParams, options: { query:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getContact>>, TError, TData>> & Pick<
        DefinedInitialDataOptions<
          Awaited<ReturnType<typeof getContact>>,
          TError,
          Awaited<ReturnType<typeof getContact>>
        > , 'initialData'
      >, request?: SecondParameter<typeof useCustomClient>}
 , queryClient?: QueryClient
  ):  DefinedUseInfiniteQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetContactInfinite<TData = InfiniteData<Awaited<ReturnType<typeof getContact>>>, TError = ErrorType<unknown>>(
 params?: GetContactParams, options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getContact>>, TError, TData>> & Pick<
        UndefinedInitialDataOptions<
          Awaited<ReturnType<typeof getContact>>,
          TError,
          Awaited<ReturnType<typeof getContact>>
        > , 'initialData'
      >, request?: SecondParameter<typeof useCustomClient>}
 , queryClient?: QueryClient
  ):  UseInfiniteQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetContactInfinite<TData = InfiniteData<Awaited<ReturnType<typeof getContact>>>, TError = ErrorType<unknown>>(
 params?: GetContactParams, options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getContact>>, TError, TData>>, request?: SecondParameter<typeof useCustomClient>}
 , queryClient?: QueryClient
  ):  UseInfiniteQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
/**
 * @summary Get all contact
 */

export function useGetContactInfinite<TData = InfiniteData<Awaited<ReturnType<typeof getContact>>>, TError = ErrorType<unknown>>(
 params?: GetContactParams, options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getContact>>, TError, TData>>, request?: SecondParameter<typeof useCustomClient>}
 , queryClient?: QueryClient 
 ):  UseInfiniteQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {

  const queryOptions = getGetContactInfiniteQueryOptions(params,options)

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

  query.queryKey = queryOptions.queryKey ;

  return query;
}

/**
 * @summary Get all contact
 */
export const prefetchGetContactInfiniteQuery = async <TData = Awaited<ReturnType<typeof getContact>>, TError = ErrorType<unknown>>(
 queryClient: QueryClient, params?: GetContactParams, options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getContact>>, TError, TData>>, request?: SecondParameter<typeof useCustomClient>}

  ): Promise<QueryClient> => {

  const queryOptions = getGetContactInfiniteQueryOptions(params,options)

  await queryClient.prefetchInfiniteQuery(queryOptions);

  return queryClient;
}



export const getGetContactQueryOptions = <TData = Awaited<ReturnType<typeof getContact>>, TError = ErrorType<unknown>>(params?: GetContactParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getContact>>, TError, TData>>, request?: SecondParameter<typeof useCustomClient>}
) => {

const {query: queryOptions, request: requestOptions} = options ?? {};

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

  

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

      

      

   return  { queryKey, queryFn,   retry: 3, retryDelay: 1000,  ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof getContact>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }
}

export type GetContactQueryResult = NonNullable<Awaited<ReturnType<typeof getContact>>>
export type GetContactQueryError = ErrorType<unknown>


export function useGetContact<TData = Awaited<ReturnType<typeof getContact>>, TError = ErrorType<unknown>>(
 params: undefined |  GetContactParams, options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof getContact>>, TError, TData>> & Pick<
        DefinedInitialDataOptions<
          Awaited<ReturnType<typeof getContact>>,
          TError,
          Awaited<ReturnType<typeof getContact>>
        > , 'initialData'
      >, request?: SecondParameter<typeof useCustomClient>}
 , queryClient?: QueryClient
  ):  DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetContact<TData = Awaited<ReturnType<typeof getContact>>, TError = ErrorType<unknown>>(
 params?: GetContactParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getContact>>, TError, TData>> & Pick<
        UndefinedInitialDataOptions<
          Awaited<ReturnType<typeof getContact>>,
          TError,
          Awaited<ReturnType<typeof getContact>>
        > , 'initialData'
      >, request?: SecondParameter<typeof useCustomClient>}
 , queryClient?: QueryClient
  ):  UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetContact<TData = Awaited<ReturnType<typeof getContact>>, TError = ErrorType<unknown>>(
 params?: GetContactParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getContact>>, TError, TData>>, request?: SecondParameter<typeof useCustomClient>}
 , queryClient?: QueryClient
  ):  UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
/**
 * @summary Get all contact
 */

export function useGetContact<TData = Awaited<ReturnType<typeof getContact>>, TError = ErrorType<unknown>>(
 params?: GetContactParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getContact>>, TError, TData>>, request?: SecondParameter<typeof useCustomClient>}
 , queryClient?: QueryClient 
 ):  UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {

  const queryOptions = getGetContactQueryOptions(params,options)

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

  query.queryKey = queryOptions.queryKey ;

  return query;
}

/**
 * @summary Get all contact
 */
export const prefetchGetContactQuery = async <TData = Awaited<ReturnType<typeof getContact>>, TError = ErrorType<unknown>>(
 queryClient: QueryClient, params?: GetContactParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getContact>>, TError, TData>>, request?: SecondParameter<typeof useCustomClient>}

  ): Promise<QueryClient> => {

  const queryOptions = getGetContactQueryOptions(params,options)

  await queryClient.prefetchQuery(queryOptions);

  return queryClient;
}



/**
 * Create a new contact record
 * @summary Create a contact
 */
export type postContactResponse200 = {
  data: PostContact200
  status: 200
}
    
export type postContactResponseSuccess = (postContactResponse200) & {
  headers: Headers;
};
;

export type postContactResponse = (postContactResponseSuccess)

export const getPostContactUrl = () => {


  

  return `/contact`
}

export const postContact = async (contactMutate: ContactMutate, options?: RequestInit): Promise<postContactResponse> => {
  
  return useCustomClient<postContactResponse>(getPostContactUrl(),
  {      
    ...options,
    method: 'POST',
    headers: { 'Content-Type': 'application/json', ...options?.headers },
    body: JSON.stringify(
      contactMutate,)
  }
);}




export const getPostContactMutationOptions = <TError = ErrorType<unknown>,
    TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof postContact>>, TError,{data: BodyType<ContactMutate>}, TContext>, request?: SecondParameter<typeof useCustomClient>}
): UseMutationOptions<Awaited<ReturnType<typeof postContact>>, TError,{data: BodyType<ContactMutate>}, TContext> => {

const mutationKey = ['postContact'];
const {mutation: mutationOptions, request: requestOptions} = options ?
      options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
      options
      : {...options, mutation: {...options.mutation, mutationKey}}
      : {mutation: { mutationKey, }, request: undefined};

      


      const mutationFn: MutationFunction<Awaited<ReturnType<typeof postContact>>, {data: BodyType<ContactMutate>}> = (props) => {
          const {data} = props ?? {};

          return  postContact(data,requestOptions)
        }

        


  return  { mutationFn, ...mutationOptions }}

    export type PostContactMutationResult = NonNullable<Awaited<ReturnType<typeof postContact>>>
    export type PostContactMutationBody = BodyType<ContactMutate>
    export type PostContactMutationError = ErrorType<unknown>

    /**
 * @summary Create a contact
 */
export const usePostContact = <TError = ErrorType<unknown>,
    TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof postContact>>, TError,{data: BodyType<ContactMutate>}, TContext>, request?: SecondParameter<typeof useCustomClient>}
 , queryClient?: QueryClient): UseMutationResult<
        Awaited<ReturnType<typeof postContact>>,
        TError,
        {data: BodyType<ContactMutate>},
        TContext
      > => {

      const mutationOptions = getPostContactMutationOptions(options);

      return useMutation(mutationOptions, queryClient);
    }
    