/**
 * Periodic snapshot of a single metric for a database. Collected by the snapshot_usage() cron job in constructive-limits. Each row records one metric measurement (e.g. reads, writes, storage_bytes) at a point in time, with optional dimensions for sub-metric breakdowns.
 * @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 { usageSnapshotKeys } from '../query-keys';
import { usageSnapshotMutationKeys } from '../mutation-keys';
export function useDeleteUsageSnapshotMutation(params) {
    const args = buildSelectionArgs(params.selection);
    const { selection: _selection, ...mutationOptions } = params ?? {};
    void _selection;
    const queryClient = useQueryClient();
    return useMutation({
        mutationKey: usageSnapshotMutationKeys.all,
        mutationFn: ({ id }) => getClient()
            .usageSnapshot.delete({
            where: {
                id,
            },
            select: args.select,
        })
            .unwrap(),
        onSuccess: (_, variables) => {
            queryClient.removeQueries({
                queryKey: usageSnapshotKeys.detail(variables.id),
            });
            queryClient.invalidateQueries({
                queryKey: usageSnapshotKeys.lists(),
            });
        },
        ...mutationOptions,
    });
}
