/**
 * Config row for the webauthn_credentials_module, which provisions the per-user WebAuthn/passkey credentials table (public key, counter, transports, device type, backup state) mirroring crypto_addresses_module. The sibling webauthn_auth_module holds RP config and the registration/sign-in challenge state.
 * @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 { webauthnCredentialsModuleKeys } from '../query-keys';
import { webauthnCredentialsModuleMutationKeys } from '../mutation-keys';
export function useDeleteWebauthnCredentialsModuleMutation(params) {
    const args = buildSelectionArgs(params.selection);
    const { selection: _selection, ...mutationOptions } = params ?? {};
    void _selection;
    const queryClient = useQueryClient();
    return useMutation({
        mutationKey: webauthnCredentialsModuleMutationKeys.all,
        mutationFn: ({ id }) => getClient()
            .webauthnCredentialsModule.delete({
            where: {
                id,
            },
            select: args.select,
        })
            .unwrap(),
        onSuccess: (_, variables) => {
            queryClient.removeQueries({
                queryKey: webauthnCredentialsModuleKeys.detail(variables.id),
            });
            queryClient.invalidateQueries({
                queryKey: webauthnCredentialsModuleKeys.lists(),
            });
        },
        ...mutationOptions,
    });
}
