/**
 * Webhook route authority: (host, path) -> function task_identifier invoked through the webhook channel, with provider, signing-secret reference, and replay window
 * @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 { webhookEndpointKeys } from '../query-keys';
import { webhookEndpointMutationKeys } from '../mutation-keys';
export function useUpdateWebhookEndpointMutation(params) {
    const args = buildSelectionArgs(params.selection);
    const { selection: _selection, ...mutationOptions } = params ?? {};
    void _selection;
    const queryClient = useQueryClient();
    return useMutation({
        mutationKey: webhookEndpointMutationKeys.all,
        mutationFn: ({ id, webhookEndpointPatch, }) => getClient()
            .webhookEndpoint.update({
            where: {
                id,
            },
            data: webhookEndpointPatch,
            select: args.select,
        })
            .unwrap(),
        onSuccess: (_, variables) => {
            queryClient.invalidateQueries({
                queryKey: webhookEndpointKeys.detail(variables.id),
            });
            queryClient.invalidateQueries({
                queryKey: webhookEndpointKeys.lists(),
            });
        },
        ...mutationOptions,
    });
}
