/**
 * Single item query hook for Partition
 * @generated by @constructive-io/graphql-codegen
 * DO NOT EDIT - changes will be overwritten
 */
import { useQuery } from '@tanstack/react-query';
import { getClient } from '../client';
import { buildSelectionArgs } from '../selection';
import { partitionKeys } from '../query-keys';
/** Query key factory - re-exported from query-keys.ts */
export const partitionQueryKey = partitionKeys.detail;
export function usePartitionQuery(params) {
    const args = buildSelectionArgs(params.selection);
    const { selection: _selection, ...queryOptions } = params ?? {};
    void _selection;
    return useQuery({
        queryKey: partitionKeys.detail(params.id),
        queryFn: () => getClient()
            .partition.findOne({
            id: params.id,
            select: args.select,
        })
            .unwrap(),
        ...queryOptions,
    });
}
export async function fetchPartitionQuery(params) {
    const args = buildSelectionArgs(params.selection);
    return getClient()
        .partition.findOne({
        id: params.id,
        select: args.select,
    })
        .unwrap();
}
export async function prefetchPartitionQuery(queryClient, params) {
    const args = buildSelectionArgs(params.selection);
    await queryClient.prefetchQuery({
        queryKey: partitionKeys.detail(params.id),
        queryFn: () => getClient()
            .partition.findOne({
            id: params.id,
            select: args.select,
        })
            .unwrap(),
    });
}
