/**
 * Namespace lifecycle events — audit log of creation, activation, deactivation, label changes
 * @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 { namespaceEventKeys } from '../query-keys';
import { namespaceEventMutationKeys } from '../mutation-keys';
export function useDeleteNamespaceEventMutation(params) {
    const args = buildSelectionArgs(params.selection);
    const { selection: _selection, ...mutationOptions } = params ?? {};
    void _selection;
    const queryClient = useQueryClient();
    return useMutation({
        mutationKey: namespaceEventMutationKeys.all,
        mutationFn: ({ id, createdAt }) => getClient()
            .namespaceEvent.delete({
            where: {
                id,
                createdAt,
            },
            select: args.select,
        })
            .unwrap(),
        onSuccess: (_, variables) => {
            queryClient.removeQueries({
                queryKey: namespaceEventKeys.detail(variables.id),
            });
            queryClient.invalidateQueries({
                queryKey: namespaceEventKeys.lists(),
            });
        },
        ...mutationOptions,
    });
}
