/**
 * Update mutation hook for NamespaceModule
 * @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 { namespaceModuleKeys } from '../query-keys';
import { namespaceModuleMutationKeys } from '../mutation-keys';
export function useUpdateNamespaceModuleMutation(params) {
    const args = buildSelectionArgs(params.selection);
    const { selection: _selection, ...mutationOptions } = params ?? {};
    void _selection;
    const queryClient = useQueryClient();
    return useMutation({
        mutationKey: namespaceModuleMutationKeys.all,
        mutationFn: ({ id, namespaceModulePatch, }) => getClient()
            .namespaceModule.update({
            where: {
                id,
            },
            data: namespaceModulePatch,
            select: args.select,
        })
            .unwrap(),
        onSuccess: (_, variables) => {
            queryClient.invalidateQueries({
                queryKey: namespaceModuleKeys.detail(variables.id),
            });
            queryClient.invalidateQueries({
                queryKey: namespaceModuleKeys.lists(),
            });
        },
        ...mutationOptions,
    });
}
