/**
 * Generated by orval v8.0.0-rc.0 🍺
 * Do not edit manually.
 * Backend Template API
 * Generated API documentation
 * 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 {
  CategoryMutate,
  DeleteCategoryId200,
  GetCategoryId200,
  GetCategoryParams,
  PostCategory200,
  PutCategoryId200,
  ResponseGetAllData
} from '../models';






/**
 * Retrieve a single category record by its ID
 * @summary Get category by ID
 */
export type getCategoryIdResponse200 = {
  data: GetCategoryId200
  status: 200
}

export type getCategoryIdResponse404 = {
  data: void
  status: 404
}
    
export type getCategoryIdResponseSuccess = (getCategoryIdResponse200) & {
  headers: Headers;
};
export type getCategoryIdResponseError = (getCategoryIdResponse404) & {
  headers: Headers;
};

export type getCategoryIdResponse = (getCategoryIdResponseSuccess | getCategoryIdResponseError)

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


  

  return `/category/${id}`
}

export const getCategoryId = async (id: string, options?: RequestInit): Promise<getCategoryIdResponse> => {
  
  const res = await fetch(getGetCategoryIdUrl(id),
  {      
    ...options,
    method: 'GET'
    
    
  }
)

  const body = [204, 205, 304].includes(res.status) ? null : await res.text();
  
  const data: getCategoryIdResponse['data'] = body ? JSON.parse(body) : {}
  return { data, status: res.status, headers: res.headers } as getCategoryIdResponse
}





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

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

    
export const getGetCategoryIdInfiniteQueryOptions = <TData = InfiniteData<Awaited<ReturnType<typeof getCategoryId>>>, TError = void>(id: string, options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getCategoryId>>, TError, TData>>, fetch?: RequestInit}
) => {

const {query: queryOptions, fetch: fetchOptions} = options ?? {};

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

  

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

      

      

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

export type GetCategoryIdInfiniteQueryResult = NonNullable<Awaited<ReturnType<typeof getCategoryId>>>
export type GetCategoryIdInfiniteQueryError = void


export function useGetCategoryIdInfinite<TData = InfiniteData<Awaited<ReturnType<typeof getCategoryId>>>, TError = void>(
 id: string, options: { query:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getCategoryId>>, TError, TData>> & Pick<
        DefinedInitialDataOptions<
          Awaited<ReturnType<typeof getCategoryId>>,
          TError,
          Awaited<ReturnType<typeof getCategoryId>>
        > , 'initialData'
      >, fetch?: RequestInit}
 , queryClient?: QueryClient
  ):  DefinedUseInfiniteQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetCategoryIdInfinite<TData = InfiniteData<Awaited<ReturnType<typeof getCategoryId>>>, TError = void>(
 id: string, options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getCategoryId>>, TError, TData>> & Pick<
        UndefinedInitialDataOptions<
          Awaited<ReturnType<typeof getCategoryId>>,
          TError,
          Awaited<ReturnType<typeof getCategoryId>>
        > , 'initialData'
      >, fetch?: RequestInit}
 , queryClient?: QueryClient
  ):  UseInfiniteQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetCategoryIdInfinite<TData = InfiniteData<Awaited<ReturnType<typeof getCategoryId>>>, TError = void>(
 id: string, options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getCategoryId>>, TError, TData>>, fetch?: RequestInit}
 , queryClient?: QueryClient
  ):  UseInfiniteQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
/**
 * @summary Get category by ID
 */

export function useGetCategoryIdInfinite<TData = InfiniteData<Awaited<ReturnType<typeof getCategoryId>>>, TError = void>(
 id: string, options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getCategoryId>>, TError, TData>>, fetch?: RequestInit}
 , queryClient?: QueryClient 
 ):  UseInfiniteQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {

  const queryOptions = getGetCategoryIdInfiniteQueryOptions(id,options)

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

  query.queryKey = queryOptions.queryKey ;

  return query;
}

/**
 * @summary Get category by ID
 */
export const prefetchGetCategoryIdInfiniteQuery = async <TData = Awaited<ReturnType<typeof getCategoryId>>, TError = void>(
 queryClient: QueryClient, id: string, options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getCategoryId>>, TError, TData>>, fetch?: RequestInit}

  ): Promise<QueryClient> => {

  const queryOptions = getGetCategoryIdInfiniteQueryOptions(id,options)

  await queryClient.prefetchInfiniteQuery(queryOptions);

  return queryClient;
}



export const getGetCategoryIdQueryOptions = <TData = Awaited<ReturnType<typeof getCategoryId>>, TError = void>(id: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getCategoryId>>, TError, TData>>, fetch?: RequestInit}
) => {

const {query: queryOptions, fetch: fetchOptions} = options ?? {};

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

  

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

      

      

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

export type GetCategoryIdQueryResult = NonNullable<Awaited<ReturnType<typeof getCategoryId>>>
export type GetCategoryIdQueryError = void


export function useGetCategoryId<TData = Awaited<ReturnType<typeof getCategoryId>>, TError = void>(
 id: string, options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof getCategoryId>>, TError, TData>> & Pick<
        DefinedInitialDataOptions<
          Awaited<ReturnType<typeof getCategoryId>>,
          TError,
          Awaited<ReturnType<typeof getCategoryId>>
        > , 'initialData'
      >, fetch?: RequestInit}
 , queryClient?: QueryClient
  ):  DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetCategoryId<TData = Awaited<ReturnType<typeof getCategoryId>>, TError = void>(
 id: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getCategoryId>>, TError, TData>> & Pick<
        UndefinedInitialDataOptions<
          Awaited<ReturnType<typeof getCategoryId>>,
          TError,
          Awaited<ReturnType<typeof getCategoryId>>
        > , 'initialData'
      >, fetch?: RequestInit}
 , queryClient?: QueryClient
  ):  UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetCategoryId<TData = Awaited<ReturnType<typeof getCategoryId>>, TError = void>(
 id: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getCategoryId>>, TError, TData>>, fetch?: RequestInit}
 , queryClient?: QueryClient
  ):  UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
/**
 * @summary Get category by ID
 */

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

  const queryOptions = getGetCategoryIdQueryOptions(id,options)

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

  query.queryKey = queryOptions.queryKey ;

  return query;
}

/**
 * @summary Get category by ID
 */
export const prefetchGetCategoryIdQuery = async <TData = Awaited<ReturnType<typeof getCategoryId>>, TError = void>(
 queryClient: QueryClient, id: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getCategoryId>>, TError, TData>>, fetch?: RequestInit}

  ): Promise<QueryClient> => {

  const queryOptions = getGetCategoryIdQueryOptions(id,options)

  await queryClient.prefetchQuery(queryOptions);

  return queryClient;
}



/**
 * Update a single category record by its ID
 * @summary Update category by ID
 */
export type putCategoryIdResponse200 = {
  data: PutCategoryId200
  status: 200
}

export type putCategoryIdResponse404 = {
  data: void
  status: 404
}
    
export type putCategoryIdResponseSuccess = (putCategoryIdResponse200) & {
  headers: Headers;
};
export type putCategoryIdResponseError = (putCategoryIdResponse404) & {
  headers: Headers;
};

export type putCategoryIdResponse = (putCategoryIdResponseSuccess | putCategoryIdResponseError)

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


  

  return `/category/${id}`
}

export const putCategoryId = async (id: string,
    categoryMutate: CategoryMutate, options?: RequestInit): Promise<putCategoryIdResponse> => {
  
  const res = await fetch(getPutCategoryIdUrl(id),
  {      
    ...options,
    method: 'PUT',
    headers: { 'Content-Type': 'application/json', ...options?.headers },
    body: JSON.stringify(
      categoryMutate,)
  }
)

  const body = [204, 205, 304].includes(res.status) ? null : await res.text();
  
  const data: putCategoryIdResponse['data'] = body ? JSON.parse(body) : {}
  return { data, status: res.status, headers: res.headers } as putCategoryIdResponse
}




export const getPutCategoryIdMutationOptions = <TError = void,
    TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof putCategoryId>>, TError,{id: string;data: CategoryMutate}, TContext>, fetch?: RequestInit}
): UseMutationOptions<Awaited<ReturnType<typeof putCategoryId>>, TError,{id: string;data: CategoryMutate}, TContext> => {

const mutationKey = ['putCategoryId'];
const {mutation: mutationOptions, fetch: fetchOptions} = options ?
      options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
      options
      : {...options, mutation: {...options.mutation, mutationKey}}
      : {mutation: { mutationKey, }, fetch: undefined};

      


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

          return  putCategoryId(id,data,fetchOptions)
        }

        


  return  { mutationFn, ...mutationOptions }}

    export type PutCategoryIdMutationResult = NonNullable<Awaited<ReturnType<typeof putCategoryId>>>
    export type PutCategoryIdMutationBody = CategoryMutate
    export type PutCategoryIdMutationError = void

    /**
 * @summary Update category by ID
 */
export const usePutCategoryId = <TError = void,
    TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof putCategoryId>>, TError,{id: string;data: CategoryMutate}, TContext>, fetch?: RequestInit}
 , queryClient?: QueryClient): UseMutationResult<
        Awaited<ReturnType<typeof putCategoryId>>,
        TError,
        {id: string;data: CategoryMutate},
        TContext
      > => {

      const mutationOptions = getPutCategoryIdMutationOptions(options);

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

export type deleteCategoryIdResponse404 = {
  data: void
  status: 404
}
    
export type deleteCategoryIdResponseSuccess = (deleteCategoryIdResponse200) & {
  headers: Headers;
};
export type deleteCategoryIdResponseError = (deleteCategoryIdResponse404) & {
  headers: Headers;
};

export type deleteCategoryIdResponse = (deleteCategoryIdResponseSuccess | deleteCategoryIdResponseError)

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


  

  return `/category/${id}`
}

export const deleteCategoryId = async (id: string, options?: RequestInit): Promise<deleteCategoryIdResponse> => {
  
  const res = await fetch(getDeleteCategoryIdUrl(id),
  {      
    ...options,
    method: 'DELETE'
    
    
  }
)

  const body = [204, 205, 304].includes(res.status) ? null : await res.text();
  
  const data: deleteCategoryIdResponse['data'] = body ? JSON.parse(body) : {}
  return { data, status: res.status, headers: res.headers } as deleteCategoryIdResponse
}




export const getDeleteCategoryIdMutationOptions = <TError = void,
    TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteCategoryId>>, TError,{id: string}, TContext>, fetch?: RequestInit}
): UseMutationOptions<Awaited<ReturnType<typeof deleteCategoryId>>, TError,{id: string}, TContext> => {

const mutationKey = ['deleteCategoryId'];
const {mutation: mutationOptions, fetch: fetchOptions} = options ?
      options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
      options
      : {...options, mutation: {...options.mutation, mutationKey}}
      : {mutation: { mutationKey, }, fetch: undefined};

      


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

          return  deleteCategoryId(id,fetchOptions)
        }

        


  return  { mutationFn, ...mutationOptions }}

    export type DeleteCategoryIdMutationResult = NonNullable<Awaited<ReturnType<typeof deleteCategoryId>>>
    
    export type DeleteCategoryIdMutationError = void

    /**
 * @summary Delete category by ID
 */
export const useDeleteCategoryId = <TError = void,
    TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteCategoryId>>, TError,{id: string}, TContext>, fetch?: RequestInit}
 , queryClient?: QueryClient): UseMutationResult<
        Awaited<ReturnType<typeof deleteCategoryId>>,
        TError,
        {id: string},
        TContext
      > => {

      const mutationOptions = getDeleteCategoryIdMutationOptions(options);

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

export type getCategoryResponse = (getCategoryResponseSuccess)

export const getGetCategoryUrl = (params?: GetCategoryParams,) => {
  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 ? `/category?${stringifiedParams}` : `/category`
}

export const getCategory = async (params?: GetCategoryParams, options?: RequestInit): Promise<getCategoryResponse> => {
  
  const res = await fetch(getGetCategoryUrl(params),
  {      
    ...options,
    method: 'GET'
    
    
  }
)

  const body = [204, 205, 304].includes(res.status) ? null : await res.text();
  
  const data: getCategoryResponse['data'] = body ? JSON.parse(body) : {}
  return { data, status: res.status, headers: res.headers } as getCategoryResponse
}





export const getGetCategoryInfiniteQueryKey = (params?: GetCategoryParams,) => {
    return [
    'infinite', `/category`, ...(params ? [params]: [])
    ] as const;
    }

export const getGetCategoryQueryKey = (params?: GetCategoryParams,) => {
    return [
    `/category`, ...(params ? [params]: [])
    ] as const;
    }

    
export const getGetCategoryInfiniteQueryOptions = <TData = InfiniteData<Awaited<ReturnType<typeof getCategory>>>, TError = unknown>(params?: GetCategoryParams, options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getCategory>>, TError, TData>>, fetch?: RequestInit}
) => {

const {query: queryOptions, fetch: fetchOptions} = options ?? {};

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

  

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

      

      

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

export type GetCategoryInfiniteQueryResult = NonNullable<Awaited<ReturnType<typeof getCategory>>>
export type GetCategoryInfiniteQueryError = unknown


export function useGetCategoryInfinite<TData = InfiniteData<Awaited<ReturnType<typeof getCategory>>>, TError = unknown>(
 params: undefined |  GetCategoryParams, options: { query:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getCategory>>, TError, TData>> & Pick<
        DefinedInitialDataOptions<
          Awaited<ReturnType<typeof getCategory>>,
          TError,
          Awaited<ReturnType<typeof getCategory>>
        > , 'initialData'
      >, fetch?: RequestInit}
 , queryClient?: QueryClient
  ):  DefinedUseInfiniteQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetCategoryInfinite<TData = InfiniteData<Awaited<ReturnType<typeof getCategory>>>, TError = unknown>(
 params?: GetCategoryParams, options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getCategory>>, TError, TData>> & Pick<
        UndefinedInitialDataOptions<
          Awaited<ReturnType<typeof getCategory>>,
          TError,
          Awaited<ReturnType<typeof getCategory>>
        > , 'initialData'
      >, fetch?: RequestInit}
 , queryClient?: QueryClient
  ):  UseInfiniteQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetCategoryInfinite<TData = InfiniteData<Awaited<ReturnType<typeof getCategory>>>, TError = unknown>(
 params?: GetCategoryParams, options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getCategory>>, TError, TData>>, fetch?: RequestInit}
 , queryClient?: QueryClient
  ):  UseInfiniteQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
/**
 * @summary Get all category
 */

export function useGetCategoryInfinite<TData = InfiniteData<Awaited<ReturnType<typeof getCategory>>>, TError = unknown>(
 params?: GetCategoryParams, options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getCategory>>, TError, TData>>, fetch?: RequestInit}
 , queryClient?: QueryClient 
 ):  UseInfiniteQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {

  const queryOptions = getGetCategoryInfiniteQueryOptions(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 category
 */
export const prefetchGetCategoryInfiniteQuery = async <TData = Awaited<ReturnType<typeof getCategory>>, TError = unknown>(
 queryClient: QueryClient, params?: GetCategoryParams, options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getCategory>>, TError, TData>>, fetch?: RequestInit}

  ): Promise<QueryClient> => {

  const queryOptions = getGetCategoryInfiniteQueryOptions(params,options)

  await queryClient.prefetchInfiniteQuery(queryOptions);

  return queryClient;
}



export const getGetCategoryQueryOptions = <TData = Awaited<ReturnType<typeof getCategory>>, TError = unknown>(params?: GetCategoryParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getCategory>>, TError, TData>>, fetch?: RequestInit}
) => {

const {query: queryOptions, fetch: fetchOptions} = options ?? {};

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

  

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

      

      

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

export type GetCategoryQueryResult = NonNullable<Awaited<ReturnType<typeof getCategory>>>
export type GetCategoryQueryError = unknown


export function useGetCategory<TData = Awaited<ReturnType<typeof getCategory>>, TError = unknown>(
 params: undefined |  GetCategoryParams, options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof getCategory>>, TError, TData>> & Pick<
        DefinedInitialDataOptions<
          Awaited<ReturnType<typeof getCategory>>,
          TError,
          Awaited<ReturnType<typeof getCategory>>
        > , 'initialData'
      >, fetch?: RequestInit}
 , queryClient?: QueryClient
  ):  DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetCategory<TData = Awaited<ReturnType<typeof getCategory>>, TError = unknown>(
 params?: GetCategoryParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getCategory>>, TError, TData>> & Pick<
        UndefinedInitialDataOptions<
          Awaited<ReturnType<typeof getCategory>>,
          TError,
          Awaited<ReturnType<typeof getCategory>>
        > , 'initialData'
      >, fetch?: RequestInit}
 , queryClient?: QueryClient
  ):  UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetCategory<TData = Awaited<ReturnType<typeof getCategory>>, TError = unknown>(
 params?: GetCategoryParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getCategory>>, TError, TData>>, fetch?: RequestInit}
 , queryClient?: QueryClient
  ):  UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
/**
 * @summary Get all category
 */

export function useGetCategory<TData = Awaited<ReturnType<typeof getCategory>>, TError = unknown>(
 params?: GetCategoryParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getCategory>>, TError, TData>>, fetch?: RequestInit}
 , queryClient?: QueryClient 
 ):  UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {

  const queryOptions = getGetCategoryQueryOptions(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 category
 */
export const prefetchGetCategoryQuery = async <TData = Awaited<ReturnType<typeof getCategory>>, TError = unknown>(
 queryClient: QueryClient, params?: GetCategoryParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getCategory>>, TError, TData>>, fetch?: RequestInit}

  ): Promise<QueryClient> => {

  const queryOptions = getGetCategoryQueryOptions(params,options)

  await queryClient.prefetchQuery(queryOptions);

  return queryClient;
}



/**
 * Create a new category record
 * @summary Create a category
 */
export type postCategoryResponse200 = {
  data: PostCategory200
  status: 200
}
    
export type postCategoryResponseSuccess = (postCategoryResponse200) & {
  headers: Headers;
};
;

export type postCategoryResponse = (postCategoryResponseSuccess)

export const getPostCategoryUrl = () => {


  

  return `/category`
}

export const postCategory = async (categoryMutate: CategoryMutate, options?: RequestInit): Promise<postCategoryResponse> => {
  
  const res = await fetch(getPostCategoryUrl(),
  {      
    ...options,
    method: 'POST',
    headers: { 'Content-Type': 'application/json', ...options?.headers },
    body: JSON.stringify(
      categoryMutate,)
  }
)

  const body = [204, 205, 304].includes(res.status) ? null : await res.text();
  
  const data: postCategoryResponse['data'] = body ? JSON.parse(body) : {}
  return { data, status: res.status, headers: res.headers } as postCategoryResponse
}




export const getPostCategoryMutationOptions = <TError = unknown,
    TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof postCategory>>, TError,{data: CategoryMutate}, TContext>, fetch?: RequestInit}
): UseMutationOptions<Awaited<ReturnType<typeof postCategory>>, TError,{data: CategoryMutate}, TContext> => {

const mutationKey = ['postCategory'];
const {mutation: mutationOptions, fetch: fetchOptions} = options ?
      options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
      options
      : {...options, mutation: {...options.mutation, mutationKey}}
      : {mutation: { mutationKey, }, fetch: undefined};

      


      const mutationFn: MutationFunction<Awaited<ReturnType<typeof postCategory>>, {data: CategoryMutate}> = (props) => {
          const {data} = props ?? {};

          return  postCategory(data,fetchOptions)
        }

        


  return  { mutationFn, ...mutationOptions }}

    export type PostCategoryMutationResult = NonNullable<Awaited<ReturnType<typeof postCategory>>>
    export type PostCategoryMutationBody = CategoryMutate
    export type PostCategoryMutationError = unknown

    /**
 * @summary Create a category
 */
export const usePostCategory = <TError = unknown,
    TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof postCategory>>, TError,{data: CategoryMutate}, TContext>, fetch?: RequestInit}
 , queryClient?: QueryClient): UseMutationResult<
        Awaited<ReturnType<typeof postCategory>>,
        TError,
        {data: CategoryMutate},
        TContext
      > => {

      const mutationOptions = getPostCategoryMutationOptions(options);

      return useMutation(mutationOptions, queryClient);
    }
    