/**
 * 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 { useMutation, useQueryClient } from '@tanstack/react-query';
import { getClient } from '../client';
import { buildSelectionArgs } from '../selection';
import { integrationProvidersModuleKeys } from '../query-keys';
import { integrationProvidersModuleMutationKeys } from '../mutation-keys';
export function useCreateIntegrationProvidersModuleMutation(params) {
    const args = buildSelectionArgs(params.selection);
    const { selection: _selection, ...mutationOptions } = params ?? {};
    void _selection;
    const queryClient = useQueryClient();
    return useMutation({
        mutationKey: integrationProvidersModuleMutationKeys.create(),
        mutationFn: (data) => getClient()
            .integrationProvidersModule.create({
            data,
            select: args.select,
        })
            .unwrap(),
        onSuccess: () => {
            queryClient.invalidateQueries({
                queryKey: integrationProvidersModuleKeys.lists(),
            });
        },
        ...mutationOptions,
    });
}
