/**
 * Function invocation log — INSERT to call a function (business-layer, metered). Linked to definitions by task_identifier string.
 * @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 { platformFunctionInvocationKeys } from '../query-keys';
import { platformFunctionInvocationMutationKeys } from '../mutation-keys';
export function useDeletePlatformFunctionInvocationMutation(params) {
    const args = buildSelectionArgs(params.selection);
    const { selection: _selection, ...mutationOptions } = params ?? {};
    void _selection;
    const queryClient = useQueryClient();
    return useMutation({
        mutationKey: platformFunctionInvocationMutationKeys.all,
        mutationFn: ({ id, createdAt }) => getClient()
            .platformFunctionInvocation.delete({
            where: {
                id,
                createdAt,
            },
            select: args.select,
        })
            .unwrap(),
        onSuccess: (_, variables) => {
            queryClient.removeQueries({
                queryKey: platformFunctionInvocationKeys.detail(variables.id),
            });
            queryClient.invalidateQueries({
                queryKey: platformFunctionInvocationKeys.lists(),
            });
        },
        ...mutationOptions,
    });
}
