/**
 * WebAuthn/passkey credentials owned by users. One row per registered authenticator (security key, device biometric, synced passkey). Schema mirrors SimpleWebAuthn's canonical Passkey object.
 * @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 { webauthnCredentialKeys } from '../query-keys';
import { webauthnCredentialMutationKeys } from '../mutation-keys';
export function useUpdateWebauthnCredentialMutation(params) {
    const args = buildSelectionArgs(params.selection);
    const { selection: _selection, ...mutationOptions } = params ?? {};
    void _selection;
    const queryClient = useQueryClient();
    return useMutation({
        mutationKey: webauthnCredentialMutationKeys.all,
        mutationFn: ({ id, webauthnCredentialPatch, }) => getClient()
            .webauthnCredential.update({
            where: {
                id,
            },
            data: webauthnCredentialPatch,
            select: args.select,
        })
            .unwrap(),
        onSuccess: (_, variables) => {
            queryClient.invalidateQueries({
                queryKey: webauthnCredentialKeys.detail(variables.id),
            });
            queryClient.invalidateQueries({
                queryKey: webauthnCredentialKeys.lists(),
            });
        },
        ...mutationOptions,
    });
}
