/**
 * Per-database WebAuthn/passkey runtime configuration; typed replacement for api_modules webauthn_challenge JSONB entries
 * @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 { webauthnSettingKeys } from '../query-keys';
import { webauthnSettingMutationKeys } from '../mutation-keys';
export function useUpdateWebauthnSettingMutation(params) {
    const args = buildSelectionArgs(params.selection);
    const { selection: _selection, ...mutationOptions } = params ?? {};
    void _selection;
    const queryClient = useQueryClient();
    return useMutation({
        mutationKey: webauthnSettingMutationKeys.all,
        mutationFn: ({ id, webauthnSettingPatch, }) => getClient()
            .webauthnSetting.update({
            where: {
                id,
            },
            data: webauthnSettingPatch,
            select: args.select,
        })
            .unwrap(),
        onSuccess: (_, variables) => {
            queryClient.invalidateQueries({
                queryKey: webauthnSettingKeys.detail(variables.id),
            });
            queryClient.invalidateQueries({
                queryKey: webauthnSettingKeys.lists(),
            });
        },
        ...mutationOptions,
    });
}
