/**
 * Config row for the identity_providers_module, which provisions a per-database identity_providers config table holding OAuth2 / OIDC (and future SAML) provider definitions: protocol kind, endpoint URLs, encrypted client secret, scopes, audience validation, PKCE, and email-handling flags. Built-in providers (google, github, apple, ...) are seeded as is_built_in=true rows; custom providers use slugs of the form custom:<slug>.
 * @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 { identityProvidersModuleKeys } from '../query-keys';
import { identityProvidersModuleMutationKeys } from '../mutation-keys';
export function useDeleteIdentityProvidersModuleMutation(params) {
    const args = buildSelectionArgs(params.selection);
    const { selection: _selection, ...mutationOptions } = params ?? {};
    void _selection;
    const queryClient = useQueryClient();
    return useMutation({
        mutationKey: identityProvidersModuleMutationKeys.all,
        mutationFn: ({ id }) => getClient()
            .identityProvidersModule.delete({
            where: {
                id,
            },
            select: args.select,
        })
            .unwrap(),
        onSuccess: (_, variables) => {
            queryClient.removeQueries({
                queryKey: identityProvidersModuleKeys.detail(variables.id),
            });
            queryClient.invalidateQueries({
                queryKey: identityProvidersModuleKeys.lists(),
            });
        },
        ...mutationOptions,
    });
}
