/**
 * 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 {
  DeleteUserDepartmentParams,
  GetUserDepartmentParams,
  PutUserDepartmentParams,
  Response,
  UserDepartment,
  UserDepartmentBody
} 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 getUserDepartmentIdResponse200 = {
  data: Response
  status: 200
}
    
export type getUserDepartmentIdResponseSuccess = (getUserDepartmentIdResponse200) & {
  headers: Headers;
};
;

export type getUserDepartmentIdResponse = (getUserDepartmentIdResponseSuccess)

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


  

  return `/user_department/${id}`
}

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





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

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

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

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

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

  

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

      

      

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

export type GetUserDepartmentIdInfiniteQueryResult = NonNullable<Awaited<ReturnType<typeof getUserDepartmentId>>>
export type GetUserDepartmentIdInfiniteQueryError = ErrorType<unknown>


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

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

  const queryOptions = getGetUserDepartmentIdInfiniteQueryOptions(id,options)

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

  query.queryKey = queryOptions.queryKey ;

  return query;
}

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

  ): Promise<QueryClient> => {

  const queryOptions = getGetUserDepartmentIdInfiniteQueryOptions(id,options)

  await queryClient.prefetchInfiniteQuery(queryOptions);

  return queryClient;
}



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

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

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

  

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

      

      

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

export type GetUserDepartmentIdQueryResult = NonNullable<Awaited<ReturnType<typeof getUserDepartmentId>>>
export type GetUserDepartmentIdQueryError = ErrorType<unknown>


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

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

  const queryOptions = getGetUserDepartmentIdQueryOptions(id,options)

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

  query.queryKey = queryOptions.queryKey ;

  return query;
}

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

  ): Promise<QueryClient> => {

  const queryOptions = getGetUserDepartmentIdQueryOptions(id,options)

  await queryClient.prefetchQuery(queryOptions);

  return queryClient;
}



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

export type putUserDepartmentIdResponse = (putUserDepartmentIdResponseSuccess)

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


  

  return `/user_department/${id}`
}

export const putUserDepartmentId = async (id: string,
    userDepartmentBody: UserDepartmentBody, options?: RequestInit): Promise<putUserDepartmentIdResponse> => {
  
  return useCustomClient<putUserDepartmentIdResponse>(getPutUserDepartmentIdUrl(id),
  {      
    ...options,
    method: 'PUT',
    headers: { 'Content-Type': 'application/json', ...options?.headers },
    body: JSON.stringify(
      userDepartmentBody,)
  }
);}




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

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

          return  putUserDepartmentId(id,data,requestOptions)
        }

        


  return  { mutationFn, ...mutationOptions }}

    export type PutUserDepartmentIdMutationResult = NonNullable<Awaited<ReturnType<typeof putUserDepartmentId>>>
    export type PutUserDepartmentIdMutationBody = BodyType<UserDepartmentBody>
    export type PutUserDepartmentIdMutationError = ErrorType<unknown>

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

      const mutationOptions = getPutUserDepartmentIdMutationOptions(options);

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

export type deleteUserDepartmentIdResponse = (deleteUserDepartmentIdResponseSuccess)

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


  

  return `/user_department/${id}`
}

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




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

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

          return  deleteUserDepartmentId(id,requestOptions)
        }

        


  return  { mutationFn, ...mutationOptions }}

    export type DeleteUserDepartmentIdMutationResult = NonNullable<Awaited<ReturnType<typeof deleteUserDepartmentId>>>
    
    export type DeleteUserDepartmentIdMutationError = ErrorType<unknown>

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

      const mutationOptions = getDeleteUserDepartmentIdMutationOptions(options);

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

export type getUserDepartmentResponse = (getUserDepartmentResponseSuccess)

export const getGetUserDepartmentUrl = (params?: GetUserDepartmentParams,) => {
  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 ? `/user_department?${stringifiedParams}` : `/user_department`
}

export const getUserDepartment = async (params?: GetUserDepartmentParams, options?: RequestInit): Promise<getUserDepartmentResponse> => {
  
  return useCustomClient<getUserDepartmentResponse>(getGetUserDepartmentUrl(params),
  {      
    ...options,
    method: 'GET'
    
    
  }
);}





export const getGetUserDepartmentInfiniteQueryKey = (params?: GetUserDepartmentParams,) => {
    return [
    'infinite', `/user_department`, ...(params ? [params]: [])
    ] as const;
    }

export const getGetUserDepartmentQueryKey = (params?: GetUserDepartmentParams,) => {
    return [
    `/user_department`, ...(params ? [params]: [])
    ] as const;
    }

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

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

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

  

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

      

      

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

export type GetUserDepartmentInfiniteQueryResult = NonNullable<Awaited<ReturnType<typeof getUserDepartment>>>
export type GetUserDepartmentInfiniteQueryError = ErrorType<unknown>


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

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

  const queryOptions = getGetUserDepartmentInfiniteQueryOptions(params,options)

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

  query.queryKey = queryOptions.queryKey ;

  return query;
}

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

  ): Promise<QueryClient> => {

  const queryOptions = getGetUserDepartmentInfiniteQueryOptions(params,options)

  await queryClient.prefetchInfiniteQuery(queryOptions);

  return queryClient;
}



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

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

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

  

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

      

      

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

export type GetUserDepartmentQueryResult = NonNullable<Awaited<ReturnType<typeof getUserDepartment>>>
export type GetUserDepartmentQueryError = ErrorType<unknown>


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

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

  const queryOptions = getGetUserDepartmentQueryOptions(params,options)

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

  query.queryKey = queryOptions.queryKey ;

  return query;
}

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

  ): Promise<QueryClient> => {

  const queryOptions = getGetUserDepartmentQueryOptions(params,options)

  await queryClient.prefetchQuery(queryOptions);

  return queryClient;
}



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

export type postUserDepartmentResponse = (postUserDepartmentResponseSuccess)

export const getPostUserDepartmentUrl = () => {


  

  return `/user_department`
}

export const postUserDepartment = async (userDepartment: UserDepartment[], options?: RequestInit): Promise<postUserDepartmentResponse> => {
  
  return useCustomClient<postUserDepartmentResponse>(getPostUserDepartmentUrl(),
  {      
    ...options,
    method: 'POST',
    headers: { 'Content-Type': 'application/json', ...options?.headers },
    body: JSON.stringify(
      userDepartment,)
  }
);}




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

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

          return  postUserDepartment(data,requestOptions)
        }

        


  return  { mutationFn, ...mutationOptions }}

    export type PostUserDepartmentMutationResult = NonNullable<Awaited<ReturnType<typeof postUserDepartment>>>
    export type PostUserDepartmentMutationBody = BodyType<UserDepartment[]>
    export type PostUserDepartmentMutationError = ErrorType<unknown>

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

      const mutationOptions = getPostUserDepartmentMutationOptions(options);

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

export type putUserDepartmentResponse = (putUserDepartmentResponseSuccess)

export const getPutUserDepartmentUrl = (params: PutUserDepartmentParams,) => {
  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 ? `/user_department?${stringifiedParams}` : `/user_department`
}

export const putUserDepartment = async (userDepartmentBody: UserDepartmentBody,
    params: PutUserDepartmentParams, options?: RequestInit): Promise<putUserDepartmentResponse> => {
  
  return useCustomClient<putUserDepartmentResponse>(getPutUserDepartmentUrl(params),
  {      
    ...options,
    method: 'PUT',
    headers: { 'Content-Type': 'application/json', ...options?.headers },
    body: JSON.stringify(
      userDepartmentBody,)
  }
);}




export const getPutUserDepartmentMutationOptions = <TError = ErrorType<unknown>,
    TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof putUserDepartment>>, TError,{data: BodyType<UserDepartmentBody>;params: PutUserDepartmentParams}, TContext>, request?: SecondParameter<typeof useCustomClient>}
): UseMutationOptions<Awaited<ReturnType<typeof putUserDepartment>>, TError,{data: BodyType<UserDepartmentBody>;params: PutUserDepartmentParams}, TContext> => {

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

          return  putUserDepartment(data,params,requestOptions)
        }

        


  return  { mutationFn, ...mutationOptions }}

    export type PutUserDepartmentMutationResult = NonNullable<Awaited<ReturnType<typeof putUserDepartment>>>
    export type PutUserDepartmentMutationBody = BodyType<UserDepartmentBody>
    export type PutUserDepartmentMutationError = ErrorType<unknown>

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

      const mutationOptions = getPutUserDepartmentMutationOptions(options);

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

export type deleteUserDepartmentResponse = (deleteUserDepartmentResponseSuccess)

export const getDeleteUserDepartmentUrl = (params: DeleteUserDepartmentParams,) => {
  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 ? `/user_department?${stringifiedParams}` : `/user_department`
}

export const deleteUserDepartment = async (params: DeleteUserDepartmentParams, options?: RequestInit): Promise<deleteUserDepartmentResponse> => {
  
  return useCustomClient<deleteUserDepartmentResponse>(getDeleteUserDepartmentUrl(params),
  {      
    ...options,
    method: 'DELETE'
    
    
  }
);}




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

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

          return  deleteUserDepartment(params,requestOptions)
        }

        


  return  { mutationFn, ...mutationOptions }}

    export type DeleteUserDepartmentMutationResult = NonNullable<Awaited<ReturnType<typeof deleteUserDepartment>>>
    
    export type DeleteUserDepartmentMutationError = ErrorType<unknown>

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

      const mutationOptions = getDeleteUserDepartmentMutationOptions(options);

      return useMutation(mutationOptions, queryClient);
    }
    