/**
 * Per-user bcrypt credential store (password hashes, API key hashes).
     Always user-scoped with AuthzDirectOwner RLS. Consumed by user_auth_module,
     identity_providers_module, and bootstrap procedures.
 * @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 { userCredentialsModuleKeys } from '../query-keys';
import { userCredentialsModuleMutationKeys } from '../mutation-keys';
export function useDeleteUserCredentialsModuleMutation(params) {
    const args = buildSelectionArgs(params.selection);
    const { selection: _selection, ...mutationOptions } = params ?? {};
    void _selection;
    const queryClient = useQueryClient();
    return useMutation({
        mutationKey: userCredentialsModuleMutationKeys.all,
        mutationFn: ({ id }) => getClient()
            .userCredentialsModule.delete({
            where: {
                id,
            },
            select: args.select,
        })
            .unwrap(),
        onSuccess: (_, variables) => {
            queryClient.removeQueries({
                queryKey: userCredentialsModuleKeys.detail(variables.id),
            });
            queryClient.invalidateQueries({
                queryKey: userCredentialsModuleKeys.lists(),
            });
        },
        ...mutationOptions,
    });
}
