/**
 * Installed resource bundle ("release") — groups a set of resources; params are merkle-versioned in the scope's shared infra store for rollback
 * @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 { resourceInstallationKeys } from '../query-keys';
import { resourceInstallationMutationKeys } from '../mutation-keys';
export function useUpdateResourceInstallationMutation(params) {
    const args = buildSelectionArgs(params.selection);
    const { selection: _selection, ...mutationOptions } = params ?? {};
    void _selection;
    const queryClient = useQueryClient();
    return useMutation({
        mutationKey: resourceInstallationMutationKeys.all,
        mutationFn: ({ id, resourceInstallationPatch, }) => getClient()
            .resourceInstallation.update({
            where: {
                id,
            },
            data: resourceInstallationPatch,
            select: args.select,
        })
            .unwrap(),
        onSuccess: (_, variables) => {
            queryClient.invalidateQueries({
                queryKey: resourceInstallationKeys.detail(variables.id),
            });
            queryClient.invalidateQueries({
                queryKey: resourceInstallationKeys.lists(),
            });
        },
        ...mutationOptions,
    });
}
