/**
 * Append-only audit log of authentication events (sign-in, sign-up, password changes, etc.)
 * @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 { auditLogKeys } from '../query-keys';
import { auditLogMutationKeys } from '../mutation-keys';
export function useUpdateAuditLogMutation(params) {
    const args = buildSelectionArgs(params.selection);
    const { selection: _selection, ...mutationOptions } = params ?? {};
    void _selection;
    const queryClient = useQueryClient();
    return useMutation({
        mutationKey: auditLogMutationKeys.all,
        mutationFn: ({ id, auditLogPatch }) => getClient()
            .auditLog.update({
            where: {
                id,
            },
            data: auditLogPatch,
            select: args.select,
        })
            .unwrap(),
        onSuccess: (_, variables) => {
            queryClient.invalidateQueries({
                queryKey: auditLogKeys.detail(variables.id),
            });
            queryClient.invalidateQueries({
                queryKey: auditLogKeys.lists(),
            });
        },
        ...mutationOptions,
    });
}
