/**
 * Join table linking APIs to the database schemas they expose; controls which schemas are accessible through each API
 * @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 { apiSchemaKeys } from '../query-keys';
/** Query key factory - re-exported from query-keys.ts */
export const apiSchemaQueryKey = apiSchemaKeys.detail;
export function useApiSchemaQuery(params) {
    const args = buildSelectionArgs(params.selection);
    const { selection: _selection, ...queryOptions } = params ?? {};
    void _selection;
    return useQuery({
        queryKey: apiSchemaKeys.detail(params.id),
        queryFn: () => getClient()
            .apiSchema.findOne({
            id: params.id,
            select: args.select,
        })
            .unwrap(),
        ...queryOptions,
    });
}
export async function fetchApiSchemaQuery(params) {
    const args = buildSelectionArgs(params.selection);
    return getClient()
        .apiSchema.findOne({
        id: params.id,
        select: args.select,
    })
        .unwrap();
}
export async function prefetchApiSchemaQuery(queryClient, params) {
    const args = buildSelectionArgs(params.selection);
    await queryClient.prefetchQuery({
        queryKey: apiSchemaKeys.detail(params.id),
        queryFn: () => getClient()
            .apiSchema.findOne({
            id: params.id,
            select: args.select,
        })
            .unwrap(),
    });
}
