/**
 * Config row for the config_secrets_org_module, which provisions an organization-scoped encrypted key-value secrets store with manage_secrets permission and entity-membership RLS.
 * @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 { configSecretsOrgModuleKeys } from '../query-keys';
import { configSecretsOrgModuleMutationKeys } from '../mutation-keys';
export function useUpdateConfigSecretsOrgModuleMutation(params) {
    const args = buildSelectionArgs(params.selection);
    const { selection: _selection, ...mutationOptions } = params ?? {};
    void _selection;
    const queryClient = useQueryClient();
    return useMutation({
        mutationKey: configSecretsOrgModuleMutationKeys.all,
        mutationFn: ({ id, configSecretsOrgModulePatch, }) => getClient()
            .configSecretsOrgModule.update({
            where: {
                id,
            },
            data: configSecretsOrgModulePatch,
            select: args.select,
        })
            .unwrap(),
        onSuccess: (_, variables) => {
            queryClient.invalidateQueries({
                queryKey: configSecretsOrgModuleKeys.detail(variables.id),
            });
            queryClient.invalidateQueries({
                queryKey: configSecretsOrgModuleKeys.lists(),
            });
        },
        ...mutationOptions,
    });
}
