/**
 * Durable webhook acceptance log — one row per accepted delivery, deduplicated on (endpoint_id, external_event_id), linked to the pending function invocation it enqueued
 * @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 { platformWebhookEventKeys } from '../query-keys';
import { platformWebhookEventMutationKeys } from '../mutation-keys';
export function useUpdatePlatformWebhookEventMutation(params) {
    const args = buildSelectionArgs(params.selection);
    const { selection: _selection, ...mutationOptions } = params ?? {};
    void _selection;
    const queryClient = useQueryClient();
    return useMutation({
        mutationKey: platformWebhookEventMutationKeys.all,
        mutationFn: ({ id, platformWebhookEventPatch, }) => getClient()
            .platformWebhookEvent.update({
            where: {
                id,
            },
            data: platformWebhookEventPatch,
            select: args.select,
        })
            .unwrap(),
        onSuccess: (_, variables) => {
            queryClient.invalidateQueries({
                queryKey: platformWebhookEventKeys.detail(variables.id),
            });
            queryClient.invalidateQueries({
                queryKey: platformWebhookEventKeys.lists(),
            });
        },
        ...mutationOptions,
    });
}
