/**
 * Generated by orval v8.0.0-rc.0 🍺
 * Do not edit manually.
 * VCCI
 * 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 {
  DeletePermisionFunctionParams,
  GetPermisionFunctionParams,
  PermisionFunction,
  PermisionFunctionBody,
  PutPermisionFunctionParams,
  Response
} 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];



/**
 * Get
 */
export type getPermisionFunctionIdResponse200 = {
  data: Response
  status: 200
}
    
export type getPermisionFunctionIdResponseSuccess = (getPermisionFunctionIdResponse200) & {
  headers: Headers;
};
;

export type getPermisionFunctionIdResponse = (getPermisionFunctionIdResponseSuccess)

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


  

  return `/permision_function/${id}`
}

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





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

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

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

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

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

  

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

      

      

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

export type GetPermisionFunctionIdInfiniteQueryResult = NonNullable<Awaited<ReturnType<typeof getPermisionFunctionId>>>
export type GetPermisionFunctionIdInfiniteQueryError = ErrorType<unknown>


export function useGetPermisionFunctionIdInfinite<TData = InfiniteData<Awaited<ReturnType<typeof getPermisionFunctionId>>>, TError = ErrorType<unknown>>(
 id: string, options: { query:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getPermisionFunctionId>>, TError, TData>> & Pick<
        DefinedInitialDataOptions<
          Awaited<ReturnType<typeof getPermisionFunctionId>>,
          TError,
          Awaited<ReturnType<typeof getPermisionFunctionId>>
        > , 'initialData'
      >, request?: SecondParameter<typeof useCustomClient>}
 , queryClient?: QueryClient
  ):  DefinedUseInfiniteQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetPermisionFunctionIdInfinite<TData = InfiniteData<Awaited<ReturnType<typeof getPermisionFunctionId>>>, TError = ErrorType<unknown>>(
 id: string, options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getPermisionFunctionId>>, TError, TData>> & Pick<
        UndefinedInitialDataOptions<
          Awaited<ReturnType<typeof getPermisionFunctionId>>,
          TError,
          Awaited<ReturnType<typeof getPermisionFunctionId>>
        > , 'initialData'
      >, request?: SecondParameter<typeof useCustomClient>}
 , queryClient?: QueryClient
  ):  UseInfiniteQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetPermisionFunctionIdInfinite<TData = InfiniteData<Awaited<ReturnType<typeof getPermisionFunctionId>>>, TError = ErrorType<unknown>>(
 id: string, options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getPermisionFunctionId>>, TError, TData>>, request?: SecondParameter<typeof useCustomClient>}
 , queryClient?: QueryClient
  ):  UseInfiniteQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }

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

  const queryOptions = getGetPermisionFunctionIdInfiniteQueryOptions(id,options)

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

  query.queryKey = queryOptions.queryKey ;

  return query;
}

export const prefetchGetPermisionFunctionIdInfiniteQuery = async <TData = Awaited<ReturnType<typeof getPermisionFunctionId>>, TError = ErrorType<unknown>>(
 queryClient: QueryClient, id: string, options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getPermisionFunctionId>>, TError, TData>>, request?: SecondParameter<typeof useCustomClient>}

  ): Promise<QueryClient> => {

  const queryOptions = getGetPermisionFunctionIdInfiniteQueryOptions(id,options)

  await queryClient.prefetchInfiniteQuery(queryOptions);

  return queryClient;
}



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

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

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

  

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

      

      

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

export type GetPermisionFunctionIdQueryResult = NonNullable<Awaited<ReturnType<typeof getPermisionFunctionId>>>
export type GetPermisionFunctionIdQueryError = ErrorType<unknown>


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

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

  const queryOptions = getGetPermisionFunctionIdQueryOptions(id,options)

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

  query.queryKey = queryOptions.queryKey ;

  return query;
}

export const prefetchGetPermisionFunctionIdQuery = async <TData = Awaited<ReturnType<typeof getPermisionFunctionId>>, TError = ErrorType<unknown>>(
 queryClient: QueryClient, id: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getPermisionFunctionId>>, TError, TData>>, request?: SecondParameter<typeof useCustomClient>}

  ): Promise<QueryClient> => {

  const queryOptions = getGetPermisionFunctionIdQueryOptions(id,options)

  await queryClient.prefetchQuery(queryOptions);

  return queryClient;
}



/**
 * Put
 */
export type putPermisionFunctionIdResponse200 = {
  data: Response
  status: 200
}
    
export type putPermisionFunctionIdResponseSuccess = (putPermisionFunctionIdResponse200) & {
  headers: Headers;
};
;

export type putPermisionFunctionIdResponse = (putPermisionFunctionIdResponseSuccess)

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


  

  return `/permision_function/${id}`
}

export const putPermisionFunctionId = async (id: string,
    permisionFunctionBody: PermisionFunctionBody, options?: RequestInit): Promise<putPermisionFunctionIdResponse> => {
  
  return useCustomClient<putPermisionFunctionIdResponse>(getPutPermisionFunctionIdUrl(id),
  {      
    ...options,
    method: 'PUT',
    headers: { 'Content-Type': 'application/json', ...options?.headers },
    body: JSON.stringify(
      permisionFunctionBody,)
  }
);}




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

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

          return  putPermisionFunctionId(id,data,requestOptions)
        }

        


  return  { mutationFn, ...mutationOptions }}

    export type PutPermisionFunctionIdMutationResult = NonNullable<Awaited<ReturnType<typeof putPermisionFunctionId>>>
    export type PutPermisionFunctionIdMutationBody = BodyType<PermisionFunctionBody>
    export type PutPermisionFunctionIdMutationError = ErrorType<unknown>

    export const usePutPermisionFunctionId = <TError = ErrorType<unknown>,
    TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof putPermisionFunctionId>>, TError,{id: string;data: BodyType<PermisionFunctionBody>}, TContext>, request?: SecondParameter<typeof useCustomClient>}
 , queryClient?: QueryClient): UseMutationResult<
        Awaited<ReturnType<typeof putPermisionFunctionId>>,
        TError,
        {id: string;data: BodyType<PermisionFunctionBody>},
        TContext
      > => {

      const mutationOptions = getPutPermisionFunctionIdMutationOptions(options);

      return useMutation(mutationOptions, queryClient);
    }
    /**
 * Delete
 */
export type deletePermisionFunctionIdResponse200 = {
  data: Response
  status: 200
}
    
export type deletePermisionFunctionIdResponseSuccess = (deletePermisionFunctionIdResponse200) & {
  headers: Headers;
};
;

export type deletePermisionFunctionIdResponse = (deletePermisionFunctionIdResponseSuccess)

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


  

  return `/permision_function/${id}`
}

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




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

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

          return  deletePermisionFunctionId(id,requestOptions)
        }

        


  return  { mutationFn, ...mutationOptions }}

    export type DeletePermisionFunctionIdMutationResult = NonNullable<Awaited<ReturnType<typeof deletePermisionFunctionId>>>
    
    export type DeletePermisionFunctionIdMutationError = ErrorType<unknown>

    export const useDeletePermisionFunctionId = <TError = ErrorType<unknown>,
    TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deletePermisionFunctionId>>, TError,{id: string}, TContext>, request?: SecondParameter<typeof useCustomClient>}
 , queryClient?: QueryClient): UseMutationResult<
        Awaited<ReturnType<typeof deletePermisionFunctionId>>,
        TError,
        {id: string},
        TContext
      > => {

      const mutationOptions = getDeletePermisionFunctionIdMutationOptions(options);

      return useMutation(mutationOptions, queryClient);
    }
    /**
 * Get
 */
export type getPermisionFunctionResponse200 = {
  data: Response
  status: 200
}
    
export type getPermisionFunctionResponseSuccess = (getPermisionFunctionResponse200) & {
  headers: Headers;
};
;

export type getPermisionFunctionResponse = (getPermisionFunctionResponseSuccess)

export const getGetPermisionFunctionUrl = (params?: GetPermisionFunctionParams,) => {
  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 ? `/permision_function?${stringifiedParams}` : `/permision_function`
}

export const getPermisionFunction = async (params?: GetPermisionFunctionParams, options?: RequestInit): Promise<getPermisionFunctionResponse> => {
  
  return useCustomClient<getPermisionFunctionResponse>(getGetPermisionFunctionUrl(params),
  {      
    ...options,
    method: 'GET'
    
    
  }
);}





export const getGetPermisionFunctionInfiniteQueryKey = (params?: GetPermisionFunctionParams,) => {
    return [
    'infinite', `/permision_function`, ...(params ? [params]: [])
    ] as const;
    }

export const getGetPermisionFunctionQueryKey = (params?: GetPermisionFunctionParams,) => {
    return [
    `/permision_function`, ...(params ? [params]: [])
    ] as const;
    }

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

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

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

  

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

      

      

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

export type GetPermisionFunctionInfiniteQueryResult = NonNullable<Awaited<ReturnType<typeof getPermisionFunction>>>
export type GetPermisionFunctionInfiniteQueryError = ErrorType<unknown>


export function useGetPermisionFunctionInfinite<TData = InfiniteData<Awaited<ReturnType<typeof getPermisionFunction>>>, TError = ErrorType<unknown>>(
 params: undefined |  GetPermisionFunctionParams, options: { query:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getPermisionFunction>>, TError, TData>> & Pick<
        DefinedInitialDataOptions<
          Awaited<ReturnType<typeof getPermisionFunction>>,
          TError,
          Awaited<ReturnType<typeof getPermisionFunction>>
        > , 'initialData'
      >, request?: SecondParameter<typeof useCustomClient>}
 , queryClient?: QueryClient
  ):  DefinedUseInfiniteQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetPermisionFunctionInfinite<TData = InfiniteData<Awaited<ReturnType<typeof getPermisionFunction>>>, TError = ErrorType<unknown>>(
 params?: GetPermisionFunctionParams, options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getPermisionFunction>>, TError, TData>> & Pick<
        UndefinedInitialDataOptions<
          Awaited<ReturnType<typeof getPermisionFunction>>,
          TError,
          Awaited<ReturnType<typeof getPermisionFunction>>
        > , 'initialData'
      >, request?: SecondParameter<typeof useCustomClient>}
 , queryClient?: QueryClient
  ):  UseInfiniteQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetPermisionFunctionInfinite<TData = InfiniteData<Awaited<ReturnType<typeof getPermisionFunction>>>, TError = ErrorType<unknown>>(
 params?: GetPermisionFunctionParams, options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getPermisionFunction>>, TError, TData>>, request?: SecondParameter<typeof useCustomClient>}
 , queryClient?: QueryClient
  ):  UseInfiniteQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }

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

  const queryOptions = getGetPermisionFunctionInfiniteQueryOptions(params,options)

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

  query.queryKey = queryOptions.queryKey ;

  return query;
}

export const prefetchGetPermisionFunctionInfiniteQuery = async <TData = Awaited<ReturnType<typeof getPermisionFunction>>, TError = ErrorType<unknown>>(
 queryClient: QueryClient, params?: GetPermisionFunctionParams, options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getPermisionFunction>>, TError, TData>>, request?: SecondParameter<typeof useCustomClient>}

  ): Promise<QueryClient> => {

  const queryOptions = getGetPermisionFunctionInfiniteQueryOptions(params,options)

  await queryClient.prefetchInfiniteQuery(queryOptions);

  return queryClient;
}



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

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

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

  

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

      

      

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

export type GetPermisionFunctionQueryResult = NonNullable<Awaited<ReturnType<typeof getPermisionFunction>>>
export type GetPermisionFunctionQueryError = ErrorType<unknown>


export function useGetPermisionFunction<TData = Awaited<ReturnType<typeof getPermisionFunction>>, TError = ErrorType<unknown>>(
 params: undefined |  GetPermisionFunctionParams, options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof getPermisionFunction>>, TError, TData>> & Pick<
        DefinedInitialDataOptions<
          Awaited<ReturnType<typeof getPermisionFunction>>,
          TError,
          Awaited<ReturnType<typeof getPermisionFunction>>
        > , 'initialData'
      >, request?: SecondParameter<typeof useCustomClient>}
 , queryClient?: QueryClient
  ):  DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetPermisionFunction<TData = Awaited<ReturnType<typeof getPermisionFunction>>, TError = ErrorType<unknown>>(
 params?: GetPermisionFunctionParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getPermisionFunction>>, TError, TData>> & Pick<
        UndefinedInitialDataOptions<
          Awaited<ReturnType<typeof getPermisionFunction>>,
          TError,
          Awaited<ReturnType<typeof getPermisionFunction>>
        > , 'initialData'
      >, request?: SecondParameter<typeof useCustomClient>}
 , queryClient?: QueryClient
  ):  UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetPermisionFunction<TData = Awaited<ReturnType<typeof getPermisionFunction>>, TError = ErrorType<unknown>>(
 params?: GetPermisionFunctionParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getPermisionFunction>>, TError, TData>>, request?: SecondParameter<typeof useCustomClient>}
 , queryClient?: QueryClient
  ):  UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }

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

  const queryOptions = getGetPermisionFunctionQueryOptions(params,options)

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

  query.queryKey = queryOptions.queryKey ;

  return query;
}

export const prefetchGetPermisionFunctionQuery = async <TData = Awaited<ReturnType<typeof getPermisionFunction>>, TError = ErrorType<unknown>>(
 queryClient: QueryClient, params?: GetPermisionFunctionParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getPermisionFunction>>, TError, TData>>, request?: SecondParameter<typeof useCustomClient>}

  ): Promise<QueryClient> => {

  const queryOptions = getGetPermisionFunctionQueryOptions(params,options)

  await queryClient.prefetchQuery(queryOptions);

  return queryClient;
}



/**
 * Post
 */
export type postPermisionFunctionResponse200 = {
  data: Response
  status: 200
}
    
export type postPermisionFunctionResponseSuccess = (postPermisionFunctionResponse200) & {
  headers: Headers;
};
;

export type postPermisionFunctionResponse = (postPermisionFunctionResponseSuccess)

export const getPostPermisionFunctionUrl = () => {


  

  return `/permision_function`
}

export const postPermisionFunction = async (permisionFunction: PermisionFunction[], options?: RequestInit): Promise<postPermisionFunctionResponse> => {
  
  return useCustomClient<postPermisionFunctionResponse>(getPostPermisionFunctionUrl(),
  {      
    ...options,
    method: 'POST',
    headers: { 'Content-Type': 'application/json', ...options?.headers },
    body: JSON.stringify(
      permisionFunction,)
  }
);}




export const getPostPermisionFunctionMutationOptions = <TError = ErrorType<unknown>,
    TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof postPermisionFunction>>, TError,{data: BodyType<PermisionFunction[]>}, TContext>, request?: SecondParameter<typeof useCustomClient>}
): UseMutationOptions<Awaited<ReturnType<typeof postPermisionFunction>>, TError,{data: BodyType<PermisionFunction[]>}, TContext> => {

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

          return  postPermisionFunction(data,requestOptions)
        }

        


  return  { mutationFn, ...mutationOptions }}

    export type PostPermisionFunctionMutationResult = NonNullable<Awaited<ReturnType<typeof postPermisionFunction>>>
    export type PostPermisionFunctionMutationBody = BodyType<PermisionFunction[]>
    export type PostPermisionFunctionMutationError = ErrorType<unknown>

    export const usePostPermisionFunction = <TError = ErrorType<unknown>,
    TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof postPermisionFunction>>, TError,{data: BodyType<PermisionFunction[]>}, TContext>, request?: SecondParameter<typeof useCustomClient>}
 , queryClient?: QueryClient): UseMutationResult<
        Awaited<ReturnType<typeof postPermisionFunction>>,
        TError,
        {data: BodyType<PermisionFunction[]>},
        TContext
      > => {

      const mutationOptions = getPostPermisionFunctionMutationOptions(options);

      return useMutation(mutationOptions, queryClient);
    }
    /**
 * Put
 */
export type putPermisionFunctionResponse200 = {
  data: Response
  status: 200
}
    
export type putPermisionFunctionResponseSuccess = (putPermisionFunctionResponse200) & {
  headers: Headers;
};
;

export type putPermisionFunctionResponse = (putPermisionFunctionResponseSuccess)

export const getPutPermisionFunctionUrl = (params: PutPermisionFunctionParams,) => {
  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 ? `/permision_function?${stringifiedParams}` : `/permision_function`
}

export const putPermisionFunction = async (permisionFunctionBody: PermisionFunctionBody,
    params: PutPermisionFunctionParams, options?: RequestInit): Promise<putPermisionFunctionResponse> => {
  
  return useCustomClient<putPermisionFunctionResponse>(getPutPermisionFunctionUrl(params),
  {      
    ...options,
    method: 'PUT',
    headers: { 'Content-Type': 'application/json', ...options?.headers },
    body: JSON.stringify(
      permisionFunctionBody,)
  }
);}




export const getPutPermisionFunctionMutationOptions = <TError = ErrorType<unknown>,
    TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof putPermisionFunction>>, TError,{data: BodyType<PermisionFunctionBody>;params: PutPermisionFunctionParams}, TContext>, request?: SecondParameter<typeof useCustomClient>}
): UseMutationOptions<Awaited<ReturnType<typeof putPermisionFunction>>, TError,{data: BodyType<PermisionFunctionBody>;params: PutPermisionFunctionParams}, TContext> => {

const mutationKey = ['putPermisionFunction'];
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 putPermisionFunction>>, {data: BodyType<PermisionFunctionBody>;params: PutPermisionFunctionParams}> = (props) => {
          const {data,params} = props ?? {};

          return  putPermisionFunction(data,params,requestOptions)
        }

        


  return  { mutationFn, ...mutationOptions }}

    export type PutPermisionFunctionMutationResult = NonNullable<Awaited<ReturnType<typeof putPermisionFunction>>>
    export type PutPermisionFunctionMutationBody = BodyType<PermisionFunctionBody>
    export type PutPermisionFunctionMutationError = ErrorType<unknown>

    export const usePutPermisionFunction = <TError = ErrorType<unknown>,
    TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof putPermisionFunction>>, TError,{data: BodyType<PermisionFunctionBody>;params: PutPermisionFunctionParams}, TContext>, request?: SecondParameter<typeof useCustomClient>}
 , queryClient?: QueryClient): UseMutationResult<
        Awaited<ReturnType<typeof putPermisionFunction>>,
        TError,
        {data: BodyType<PermisionFunctionBody>;params: PutPermisionFunctionParams},
        TContext
      > => {

      const mutationOptions = getPutPermisionFunctionMutationOptions(options);

      return useMutation(mutationOptions, queryClient);
    }
    /**
 * Delete
 */
export type deletePermisionFunctionResponse200 = {
  data: Response
  status: 200
}
    
export type deletePermisionFunctionResponseSuccess = (deletePermisionFunctionResponse200) & {
  headers: Headers;
};
;

export type deletePermisionFunctionResponse = (deletePermisionFunctionResponseSuccess)

export const getDeletePermisionFunctionUrl = (params: DeletePermisionFunctionParams,) => {
  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 ? `/permision_function?${stringifiedParams}` : `/permision_function`
}

export const deletePermisionFunction = async (params: DeletePermisionFunctionParams, options?: RequestInit): Promise<deletePermisionFunctionResponse> => {
  
  return useCustomClient<deletePermisionFunctionResponse>(getDeletePermisionFunctionUrl(params),
  {      
    ...options,
    method: 'DELETE'
    
    
  }
);}




export const getDeletePermisionFunctionMutationOptions = <TError = ErrorType<unknown>,
    TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deletePermisionFunction>>, TError,{params: DeletePermisionFunctionParams}, TContext>, request?: SecondParameter<typeof useCustomClient>}
): UseMutationOptions<Awaited<ReturnType<typeof deletePermisionFunction>>, TError,{params: DeletePermisionFunctionParams}, TContext> => {

const mutationKey = ['deletePermisionFunction'];
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 deletePermisionFunction>>, {params: DeletePermisionFunctionParams}> = (props) => {
          const {params} = props ?? {};

          return  deletePermisionFunction(params,requestOptions)
        }

        


  return  { mutationFn, ...mutationOptions }}

    export type DeletePermisionFunctionMutationResult = NonNullable<Awaited<ReturnType<typeof deletePermisionFunction>>>
    
    export type DeletePermisionFunctionMutationError = ErrorType<unknown>

    export const useDeletePermisionFunction = <TError = ErrorType<unknown>,
    TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deletePermisionFunction>>, TError,{params: DeletePermisionFunctionParams}, TContext>, request?: SecondParameter<typeof useCustomClient>}
 , queryClient?: QueryClient): UseMutationResult<
        Awaited<ReturnType<typeof deletePermisionFunction>>,
        TError,
        {params: DeletePermisionFunctionParams},
        TContext
      > => {

      const mutationOptions = getDeletePermisionFunctionMutationOptions(options);

      return useMutation(mutationOptions, queryClient);
    }
    