/**
 * Namespace-backed plaintext key-value config module. Requires namespace_module and emits namespace:sync_config job triggers for K8s ConfigMap synchronization.
 * @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 { infraConfigModuleKeys } from '../query-keys';
import { infraConfigModuleMutationKeys } from '../mutation-keys';
export function useCreateInfraConfigModuleMutation(params) {
    const args = buildSelectionArgs(params.selection);
    const { selection: _selection, ...mutationOptions } = params ?? {};
    void _selection;
    const queryClient = useQueryClient();
    return useMutation({
        mutationKey: infraConfigModuleMutationKeys.create(),
        mutationFn: (data) => getClient()
            .infraConfigModule.create({
            data,
            select: args.select,
        })
            .unwrap(),
        onSuccess: () => {
            queryClient.invalidateQueries({
                queryKey: infraConfigModuleKeys.lists(),
            });
        },
        ...mutationOptions,
    });
}
