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