/**
 * Logical namespace containers for grouping secrets, config, functions, and other resources
 * @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 { platformNamespaceKeys } from '../query-keys';
import { platformNamespaceMutationKeys } from '../mutation-keys';
export function useUpdatePlatformNamespaceMutation(params) {
    const args = buildSelectionArgs(params.selection);
    const { selection: _selection, ...mutationOptions } = params ?? {};
    void _selection;
    const queryClient = useQueryClient();
    return useMutation({
        mutationKey: platformNamespaceMutationKeys.all,
        mutationFn: ({ id, platformNamespacePatch, }) => getClient()
            .platformNamespace.update({
            where: {
                id,
            },
            data: platformNamespacePatch,
            select: args.select,
        })
            .unwrap(),
        onSuccess: (_, variables) => {
            queryClient.invalidateQueries({
                queryKey: platformNamespaceKeys.detail(variables.id),
            });
            queryClient.invalidateQueries({
                queryKey: platformNamespaceKeys.lists(),
            });
        },
        ...mutationOptions,
    });
}
