/**
 * 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 {
  GetPermisionsParams,
  Permision,
  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 getPermisionsIdResponse200 = {
  data: Response
  status: 200
}
    
export type getPermisionsIdResponseSuccess = (getPermisionsIdResponse200) & {
  headers: Headers;
};
;

export type getPermisionsIdResponse = (getPermisionsIdResponseSuccess)

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


  

  return `/permisions/${id}`
}

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





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

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

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

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

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

  

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

      

      

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

export type GetPermisionsIdInfiniteQueryResult = NonNullable<Awaited<ReturnType<typeof getPermisionsId>>>
export type GetPermisionsIdInfiniteQueryError = ErrorType<unknown>


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

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

  const queryOptions = getGetPermisionsIdInfiniteQueryOptions(id,options)

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

  query.queryKey = queryOptions.queryKey ;

  return query;
}

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

  ): Promise<QueryClient> => {

  const queryOptions = getGetPermisionsIdInfiniteQueryOptions(id,options)

  await queryClient.prefetchInfiniteQuery(queryOptions);

  return queryClient;
}



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

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

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

  

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

      

      

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

export type GetPermisionsIdQueryResult = NonNullable<Awaited<ReturnType<typeof getPermisionsId>>>
export type GetPermisionsIdQueryError = ErrorType<unknown>


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

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

  const queryOptions = getGetPermisionsIdQueryOptions(id,options)

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

  query.queryKey = queryOptions.queryKey ;

  return query;
}

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

  ): Promise<QueryClient> => {

  const queryOptions = getGetPermisionsIdQueryOptions(id,options)

  await queryClient.prefetchQuery(queryOptions);

  return queryClient;
}



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

export type putPermisionsIdResponse = (putPermisionsIdResponseSuccess)

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


  

  return `/permisions/${id}`
}

export const putPermisionsId = async (id: string,
    permision: Permision, options?: RequestInit): Promise<putPermisionsIdResponse> => {
  
  return useCustomClient<putPermisionsIdResponse>(getPutPermisionsIdUrl(id),
  {      
    ...options,
    method: 'PUT',
    headers: { 'Content-Type': 'application/json', ...options?.headers },
    body: JSON.stringify(
      permision,)
  }
);}




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

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

          return  putPermisionsId(id,data,requestOptions)
        }

        


  return  { mutationFn, ...mutationOptions }}

    export type PutPermisionsIdMutationResult = NonNullable<Awaited<ReturnType<typeof putPermisionsId>>>
    export type PutPermisionsIdMutationBody = BodyType<Permision>
    export type PutPermisionsIdMutationError = ErrorType<unknown>

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

      const mutationOptions = getPutPermisionsIdMutationOptions(options);

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

export type getPermisionsResponse = (getPermisionsResponseSuccess)

export const getGetPermisionsUrl = (params?: GetPermisionsParams,) => {
  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 ? `/permisions?${stringifiedParams}` : `/permisions`
}

export const getPermisions = async (params?: GetPermisionsParams, options?: RequestInit): Promise<getPermisionsResponse> => {
  
  return useCustomClient<getPermisionsResponse>(getGetPermisionsUrl(params),
  {      
    ...options,
    method: 'GET'
    
    
  }
);}





export const getGetPermisionsInfiniteQueryKey = (params?: GetPermisionsParams,) => {
    return [
    'infinite', `/permisions`, ...(params ? [params]: [])
    ] as const;
    }

export const getGetPermisionsQueryKey = (params?: GetPermisionsParams,) => {
    return [
    `/permisions`, ...(params ? [params]: [])
    ] as const;
    }

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

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

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

  

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

      

      

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

export type GetPermisionsInfiniteQueryResult = NonNullable<Awaited<ReturnType<typeof getPermisions>>>
export type GetPermisionsInfiniteQueryError = ErrorType<unknown>


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

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

  const queryOptions = getGetPermisionsInfiniteQueryOptions(params,options)

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

  query.queryKey = queryOptions.queryKey ;

  return query;
}

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

  ): Promise<QueryClient> => {

  const queryOptions = getGetPermisionsInfiniteQueryOptions(params,options)

  await queryClient.prefetchInfiniteQuery(queryOptions);

  return queryClient;
}



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

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

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

  

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

      

      

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

export type GetPermisionsQueryResult = NonNullable<Awaited<ReturnType<typeof getPermisions>>>
export type GetPermisionsQueryError = ErrorType<unknown>


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

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

  const queryOptions = getGetPermisionsQueryOptions(params,options)

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

  query.queryKey = queryOptions.queryKey ;

  return query;
}

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

  ): Promise<QueryClient> => {

  const queryOptions = getGetPermisionsQueryOptions(params,options)

  await queryClient.prefetchQuery(queryOptions);

  return queryClient;
}



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

export type postPermisionsResponse = (postPermisionsResponseSuccess)

export const getPostPermisionsUrl = () => {


  

  return `/permisions`
}

export const postPermisions = async (permision: Permision[], options?: RequestInit): Promise<postPermisionsResponse> => {
  
  return useCustomClient<postPermisionsResponse>(getPostPermisionsUrl(),
  {      
    ...options,
    method: 'POST',
    headers: { 'Content-Type': 'application/json', ...options?.headers },
    body: JSON.stringify(
      permision,)
  }
);}




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

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

          return  postPermisions(data,requestOptions)
        }

        


  return  { mutationFn, ...mutationOptions }}

    export type PostPermisionsMutationResult = NonNullable<Awaited<ReturnType<typeof postPermisions>>>
    export type PostPermisionsMutationBody = BodyType<Permision[]>
    export type PostPermisionsMutationError = ErrorType<unknown>

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

      const mutationOptions = getPostPermisionsMutationOptions(options);

      return useMutation(mutationOptions, queryClient);
    }
    