/**
 * Append-only log of limit events for historical reporting and audit
 * @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 { appLimitEventKeys } from '../query-keys';
import { appLimitEventMutationKeys } from '../mutation-keys';
export function useUpdateAppLimitEventMutation(params) {
    const args = buildSelectionArgs(params.selection);
    const { selection: _selection, ...mutationOptions } = params ?? {};
    void _selection;
    const queryClient = useQueryClient();
    return useMutation({
        mutationKey: appLimitEventMutationKeys.all,
        mutationFn: ({ id, appLimitEventPatch, }) => getClient()
            .appLimitEvent.update({
            where: {
                id,
            },
            data: appLimitEventPatch,
            select: args.select,
        })
            .unwrap(),
        onSuccess: (_, variables) => {
            queryClient.invalidateQueries({
                queryKey: appLimitEventKeys.detail(variables.id),
            });
            queryClient.invalidateQueries({
                queryKey: appLimitEventKeys.lists(),
            });
        },
        ...mutationOptions,
    });
}
