/**
 * Config row for the integration_providers_module, which provisions a per-database
     integration_providers table holding branded, reusable service definitions.
     Integration providers act as a catalog of external services (e.g. Mailgun, Postgres)
     and list the canonical secret/config names required to use them.
     Other modules (function_module, resource_module) match the provider slug as a string.
 * @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 { integrationProvidersModuleKeys } from '../query-keys';
/** Query key factory - re-exported from query-keys.ts */
export const integrationProvidersModuleQueryKey = integrationProvidersModuleKeys.detail;
export function useIntegrationProvidersModuleQuery(params) {
    const args = buildSelectionArgs(params.selection);
    const { selection: _selection, ...queryOptions } = params ?? {};
    void _selection;
    return useQuery({
        queryKey: integrationProvidersModuleKeys.detail(params.id),
        queryFn: () => getClient()
            .integrationProvidersModule.findOne({
            id: params.id,
            select: args.select,
        })
            .unwrap(),
        ...queryOptions,
    });
}
export async function fetchIntegrationProvidersModuleQuery(params) {
    const args = buildSelectionArgs(params.selection);
    return getClient()
        .integrationProvidersModule.findOne({
        id: params.id,
        select: args.select,
    })
        .unwrap();
}
export async function prefetchIntegrationProvidersModuleQuery(queryClient, params) {
    const args = buildSelectionArgs(params.selection);
    await queryClient.prefetchQuery({
        queryKey: integrationProvidersModuleKeys.detail(params.id),
        queryFn: () => getClient()
            .integrationProvidersModule.findOne({
            id: params.id,
            select: args.select,
        })
            .unwrap(),
    });
}
