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