/**
 * Commit history — each commit snapshots a tree root for a store
 * @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 { platformInfraCommitKeys } from '../query-keys';
/** Query key factory - re-exported from query-keys.ts */
export const platformInfraCommitQueryKey = platformInfraCommitKeys.detail;
export function usePlatformInfraCommitQuery(params) {
    const args = buildSelectionArgs(params.selection);
    const { selection: _selection, ...queryOptions } = params ?? {};
    void _selection;
    return useQuery({
        queryKey: platformInfraCommitKeys.detail(params.id),
        queryFn: () => getClient()
            .platformInfraCommit.findOne({
            id: params.id,
            select: args.select,
        })
            .unwrap(),
        ...queryOptions,
    });
}
export async function fetchPlatformInfraCommitQuery(params) {
    const args = buildSelectionArgs(params.selection);
    return getClient()
        .platformInfraCommit.findOne({
        id: params.id,
        select: args.select,
    })
        .unwrap();
}
export async function prefetchPlatformInfraCommitQuery(queryClient, params) {
    const args = buildSelectionArgs(params.selection);
    await queryClient.prefetchQuery({
        queryKey: platformInfraCommitKeys.detail(params.id),
        queryFn: () => getClient()
            .platformInfraCommit.findOne({
            id: params.id,
            select: args.select,
        })
            .unwrap(),
    });
}
