/**
 * 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 { platformResourceUsageSummaryKeys } from '../query-keys';
import { platformResourceUsageSummaryMutationKeys } from '../mutation-keys';
export function useUpdatePlatformResourceUsageSummaryMutation(params) {
    const args = buildSelectionArgs(params.selection);
    const { selection: _selection, ...mutationOptions } = params ?? {};
    void _selection;
    const queryClient = useQueryClient();
    return useMutation({
        mutationKey: platformResourceUsageSummaryMutationKeys.all,
        mutationFn: ({ id, date, platformResourceUsageSummaryPatch, }) => getClient()
            .platformResourceUsageSummary.update({
            where: {
                id,
                date,
            },
            data: platformResourceUsageSummaryPatch,
            select: args.select,
        })
            .unwrap(),
        onSuccess: (_, variables) => {
            queryClient.invalidateQueries({
                queryKey: platformResourceUsageSummaryKeys.detail(variables.id),
            });
            queryClient.invalidateQueries({
                queryKey: platformResourceUsageSummaryKeys.lists(),
            });
        },
        ...mutationOptions,
    });
}
