/**
 * Deployment lifecycle events — audit log of provisioning, scaling, and failure events
 * @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 { functionDeploymentEventKeys } from '../query-keys';
import { functionDeploymentEventMutationKeys } from '../mutation-keys';
export function useUpdateFunctionDeploymentEventMutation(params) {
    const args = buildSelectionArgs(params.selection);
    const { selection: _selection, ...mutationOptions } = params ?? {};
    void _selection;
    const queryClient = useQueryClient();
    return useMutation({
        mutationKey: functionDeploymentEventMutationKeys.all,
        mutationFn: ({ id, createdAt, functionDeploymentEventPatch, }) => getClient()
            .functionDeploymentEvent.update({
            where: {
                id,
                createdAt,
            },
            data: functionDeploymentEventPatch,
            select: args.select,
        })
            .unwrap(),
        onSuccess: (_, variables) => {
            queryClient.invalidateQueries({
                queryKey: functionDeploymentEventKeys.detail(variables.id),
            });
            queryClient.invalidateQueries({
                queryKey: functionDeploymentEventKeys.lists(),
            });
        },
        ...mutationOptions,
    });
}
