/**
 * 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 {
  GetPageConfigParams,
  PostPageConfigBody,
  PutPageConfigIdBody
} from '../models';






/**
 * Retrieve hierarchical page config by its ID
 * @summary Get hierarchical pageConfig by ID
 */
export type getPageConfigIdResponse200 = {
  data: void
  status: 200
}

export type getPageConfigIdResponse404 = {
  data: void
  status: 404
}
    
export type getPageConfigIdResponseSuccess = (getPageConfigIdResponse200) & {
  headers: Headers;
};
export type getPageConfigIdResponseError = (getPageConfigIdResponse404) & {
  headers: Headers;
};

export type getPageConfigIdResponse = (getPageConfigIdResponseSuccess | getPageConfigIdResponseError)

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


  

  return `/pageConfig/${id}`
}

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

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





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

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

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

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

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

  

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

      

      

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

export type GetPageConfigIdInfiniteQueryResult = NonNullable<Awaited<ReturnType<typeof getPageConfigId>>>
export type GetPageConfigIdInfiniteQueryError = void


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

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

  const queryOptions = getGetPageConfigIdInfiniteQueryOptions(id,options)

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

  query.queryKey = queryOptions.queryKey ;

  return query;
}

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

  ): Promise<QueryClient> => {

  const queryOptions = getGetPageConfigIdInfiniteQueryOptions(id,options)

  await queryClient.prefetchInfiniteQuery(queryOptions);

  return queryClient;
}



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

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

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

  

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

      

      

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

export type GetPageConfigIdQueryResult = NonNullable<Awaited<ReturnType<typeof getPageConfigId>>>
export type GetPageConfigIdQueryError = void


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

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

  const queryOptions = getGetPageConfigIdQueryOptions(id,options)

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

  query.queryKey = queryOptions.queryKey ;

  return query;
}

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

  ): Promise<QueryClient> => {

  const queryOptions = getGetPageConfigIdQueryOptions(id,options)

  await queryClient.prefetchQuery(queryOptions);

  return queryClient;
}



/**
 * Update a single pageConfig record by its ID. level is computed if parent_id changes and must not be sent.
 * @summary Update pageConfig by ID
 */
export type putPageConfigIdResponse200 = {
  data: void
  status: 200
}

export type putPageConfigIdResponse404 = {
  data: void
  status: 404
}
    
export type putPageConfigIdResponseSuccess = (putPageConfigIdResponse200) & {
  headers: Headers;
};
export type putPageConfigIdResponseError = (putPageConfigIdResponse404) & {
  headers: Headers;
};

export type putPageConfigIdResponse = (putPageConfigIdResponseSuccess | putPageConfigIdResponseError)

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


  

  return `/pageConfig/${id}`
}

export const putPageConfigId = async (id: string,
    putPageConfigIdBody: PutPageConfigIdBody, options?: RequestInit): Promise<putPageConfigIdResponse> => {
  
  const res = await fetch(getPutPageConfigIdUrl(id),
  {      
    ...options,
    method: 'PUT',
    headers: { 'Content-Type': 'application/json', ...options?.headers },
    body: JSON.stringify(
      putPageConfigIdBody,)
  }
)

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




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

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

          return  putPageConfigId(id,data,fetchOptions)
        }

        


  return  { mutationFn, ...mutationOptions }}

    export type PutPageConfigIdMutationResult = NonNullable<Awaited<ReturnType<typeof putPageConfigId>>>
    export type PutPageConfigIdMutationBody = PutPageConfigIdBody
    export type PutPageConfigIdMutationError = void

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

      const mutationOptions = getPutPageConfigIdMutationOptions(options);

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

export type deletePageConfigIdResponse404 = {
  data: void
  status: 404
}
    
export type deletePageConfigIdResponseSuccess = (deletePageConfigIdResponse200) & {
  headers: Headers;
};
export type deletePageConfigIdResponseError = (deletePageConfigIdResponse404) & {
  headers: Headers;
};

export type deletePageConfigIdResponse = (deletePageConfigIdResponseSuccess | deletePageConfigIdResponseError)

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


  

  return `/pageConfig/${id}`
}

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

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




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

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

          return  deletePageConfigId(id,fetchOptions)
        }

        


  return  { mutationFn, ...mutationOptions }}

    export type DeletePageConfigIdMutationResult = NonNullable<Awaited<ReturnType<typeof deletePageConfigId>>>
    
    export type DeletePageConfigIdMutationError = void

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

      const mutationOptions = getDeletePageConfigIdMutationOptions(options);

      return useMutation(mutationOptions, queryClient);
    }
    /**
 * Retrieve hierarchical page config by id, static_link, or code. If no parameters are provided, returns the root hierarchical structure.
 * @summary Get hierarchical pageConfig
 */
export type getPageConfigResponse200 = {
  data: void
  status: 200
}
    
export type getPageConfigResponseSuccess = (getPageConfigResponse200) & {
  headers: Headers;
};
;

export type getPageConfigResponse = (getPageConfigResponseSuccess)

export const getGetPageConfigUrl = (params?: GetPageConfigParams,) => {
  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 ? `/pageConfig?${stringifiedParams}` : `/pageConfig`
}

export const getPageConfig = async (params?: GetPageConfigParams, options?: RequestInit): Promise<getPageConfigResponse> => {
  
  const res = await fetch(getGetPageConfigUrl(params),
  {      
    ...options,
    method: 'GET'
    
    
  }
)

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





export const getGetPageConfigInfiniteQueryKey = (params?: GetPageConfigParams,) => {
    return [
    'infinite', `/pageConfig`, ...(params ? [params]: [])
    ] as const;
    }

export const getGetPageConfigQueryKey = (params?: GetPageConfigParams,) => {
    return [
    `/pageConfig`, ...(params ? [params]: [])
    ] as const;
    }

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

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

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

  

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

      

      

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

export type GetPageConfigInfiniteQueryResult = NonNullable<Awaited<ReturnType<typeof getPageConfig>>>
export type GetPageConfigInfiniteQueryError = unknown


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

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

  const queryOptions = getGetPageConfigInfiniteQueryOptions(params,options)

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

  query.queryKey = queryOptions.queryKey ;

  return query;
}

/**
 * @summary Get hierarchical pageConfig
 */
export const prefetchGetPageConfigInfiniteQuery = async <TData = Awaited<ReturnType<typeof getPageConfig>>, TError = unknown>(
 queryClient: QueryClient, params?: GetPageConfigParams, options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getPageConfig>>, TError, TData>>, fetch?: RequestInit}

  ): Promise<QueryClient> => {

  const queryOptions = getGetPageConfigInfiniteQueryOptions(params,options)

  await queryClient.prefetchInfiniteQuery(queryOptions);

  return queryClient;
}



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

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

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

  

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

      

      

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

export type GetPageConfigQueryResult = NonNullable<Awaited<ReturnType<typeof getPageConfig>>>
export type GetPageConfigQueryError = unknown


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

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

  const queryOptions = getGetPageConfigQueryOptions(params,options)

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

  query.queryKey = queryOptions.queryKey ;

  return query;
}

/**
 * @summary Get hierarchical pageConfig
 */
export const prefetchGetPageConfigQuery = async <TData = Awaited<ReturnType<typeof getPageConfig>>, TError = unknown>(
 queryClient: QueryClient, params?: GetPageConfigParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getPageConfig>>, TError, TData>>, fetch?: RequestInit}

  ): Promise<QueryClient> => {

  const queryOptions = getGetPageConfigQueryOptions(params,options)

  await queryClient.prefetchQuery(queryOptions);

  return queryClient;
}



/**
 * Create a new pageConfig record. parent_id is required. level is computed from parent and must not be sent.
 * @summary Create a pageConfig
 */
export type postPageConfigResponse200 = {
  data: void
  status: 200
}
    
export type postPageConfigResponseSuccess = (postPageConfigResponse200) & {
  headers: Headers;
};
;

export type postPageConfigResponse = (postPageConfigResponseSuccess)

export const getPostPageConfigUrl = () => {


  

  return `/pageConfig`
}

export const postPageConfig = async (postPageConfigBody: PostPageConfigBody, options?: RequestInit): Promise<postPageConfigResponse> => {
  
  const res = await fetch(getPostPageConfigUrl(),
  {      
    ...options,
    method: 'POST',
    headers: { 'Content-Type': 'application/json', ...options?.headers },
    body: JSON.stringify(
      postPageConfigBody,)
  }
)

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




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

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

          return  postPageConfig(data,fetchOptions)
        }

        


  return  { mutationFn, ...mutationOptions }}

    export type PostPageConfigMutationResult = NonNullable<Awaited<ReturnType<typeof postPageConfig>>>
    export type PostPageConfigMutationBody = PostPageConfigBody
    export type PostPageConfigMutationError = unknown

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

      const mutationOptions = getPostPageConfigMutationOptions(options);

      return useMutation(mutationOptions, queryClient);
    }
    