/**
 * Branded catalog of external service integrations and their canonical secret/config requirements. Each row defines a provider (e.g. Mailgun, Postgres) that function and resource definitions can reference by slug. The required_secrets/required_configs arrays are guidance that the UI can copy into a definition; the definition arrays remain the source of truth.
 * @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 { integrationProviderKeys } from '../query-keys';
/** Query key factory - re-exported from query-keys.ts */
export const integrationProviderQueryKey = integrationProviderKeys.detail;
export function useIntegrationProviderQuery(params) {
    const args = buildSelectionArgs(params.selection);
    const { selection: _selection, ...queryOptions } = params ?? {};
    void _selection;
    return useQuery({
        queryKey: integrationProviderKeys.detail(params.id),
        queryFn: () => getClient()
            .integrationProvider.findOne({
            id: params.id,
            select: args.select,
        })
            .unwrap(),
        ...queryOptions,
    });
}
export async function fetchIntegrationProviderQuery(params) {
    const args = buildSelectionArgs(params.selection);
    return getClient()
        .integrationProvider.findOne({
        id: params.id,
        select: args.select,
    })
        .unwrap();
}
export async function prefetchIntegrationProviderQuery(queryClient, params) {
    const args = buildSelectionArgs(params.selection);
    await queryClient.prefetchQuery({
        queryKey: integrationProviderKeys.detail(params.id),
        queryFn: () => getClient()
            .integrationProvider.findOne({
            id: params.id,
            select: args.select,
        })
            .unwrap(),
    });
}
