/**
 * App-scoped PGP-encrypted internal secrets store. No namespace_module dependency and no K8s synchronization. Used by identity_providers_module for OAuth2 client_secret storage.
 * @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 { internalSecretsModuleKeys } from '../query-keys';
import { internalSecretsModuleMutationKeys } from '../mutation-keys';
export function useDeleteInternalSecretsModuleMutation(params) {
    const args = buildSelectionArgs(params.selection);
    const { selection: _selection, ...mutationOptions } = params ?? {};
    void _selection;
    const queryClient = useQueryClient();
    return useMutation({
        mutationKey: internalSecretsModuleMutationKeys.all,
        mutationFn: ({ id }) => getClient()
            .internalSecretsModule.delete({
            where: {
                id,
            },
            select: args.select,
        })
            .unwrap(),
        onSuccess: (_, variables) => {
            queryClient.removeQueries({
                queryKey: internalSecretsModuleKeys.detail(variables.id),
            });
            queryClient.invalidateQueries({
                queryKey: internalSecretsModuleKeys.lists(),
            });
        },
        ...mutationOptions,
    });
}
