/**
 * Resource usage summaries — runtime seconds, GB-seconds, and max gauges per (resource, namespace, day); resource_id-NULL rows are namespace-grain totals
 * @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 { resourceUsageSummaryKeys } from '../query-keys';
import { resourceUsageSummaryMutationKeys } from '../mutation-keys';
export function useDeleteResourceUsageSummaryMutation(params) {
    const args = buildSelectionArgs(params.selection);
    const { selection: _selection, ...mutationOptions } = params ?? {};
    void _selection;
    const queryClient = useQueryClient();
    return useMutation({
        mutationKey: resourceUsageSummaryMutationKeys.all,
        mutationFn: ({ id, date }) => getClient()
            .resourceUsageSummary.delete({
            where: {
                id,
                date,
            },
            select: args.select,
        })
            .unwrap(),
        onSuccess: (_, variables) => {
            queryClient.removeQueries({
                queryKey: resourceUsageSummaryKeys.detail(variables.id),
            });
            queryClient.invalidateQueries({
                queryKey: resourceUsageSummaryKeys.lists(),
            });
        },
        ...mutationOptions,
    });
}
