/**
 * 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 { platformWebhookEndpointKeys } from '../query-keys';
import { platformWebhookEndpointMutationKeys } from '../mutation-keys';
export function useUpdatePlatformWebhookEndpointMutation(params) {
    const args = buildSelectionArgs(params.selection);
    const { selection: _selection, ...mutationOptions } = params ?? {};
    void _selection;
    const queryClient = useQueryClient();
    return useMutation({
        mutationKey: platformWebhookEndpointMutationKeys.all,
        mutationFn: ({ id, platformWebhookEndpointPatch, }) => getClient()
            .platformWebhookEndpoint.update({
            where: {
                id,
            },
            data: platformWebhookEndpointPatch,
            select: args.select,
        })
            .unwrap(),
        onSuccess: (_, variables) => {
            queryClient.invalidateQueries({
                queryKey: platformWebhookEndpointKeys.detail(variables.id),
            });
            queryClient.invalidateQueries({
                queryKey: platformWebhookEndpointKeys.lists(),
            });
        },
        ...mutationOptions,
    });
}
