================================================================================
FUNCTION IMPORTS ANALYSIS
================================================================================

Total function imports (internal modules): 229
  - CIRCULAR (must stay):        4
  - REDUNDANT (can remove):      0
  - MOVABLE (can move):        225


================================================================================
MOVABLE TO HEADER (grouped by source module)
These imports could potentially be moved to the module header.
================================================================================

gateway.app
-----------
  [lifespan] modules.shared.auditLogger

gateway.modules.auth.authentication
-----------------------------------
  [requireSysAdmin] modules.shared.auditLogger

gateway.modules.auth.tokenManager
---------------------------------
  [getFreshToken] modules.interfaces.interfaceDbApp
  [getFreshToken] modules.security.rootAccess

gateway.modules.auth.tokenRefreshService
----------------------------------------
  [_refresh_google_token] modules.auth.tokenManager
  [_refresh_microsoft_token] modules.auth.tokenManager
  [proactive_refresh] modules.interfaces.interfaceDbApp
  [refresh_expired_tokens] modules.interfaces.interfaceDbApp
  [proactive_refresh] modules.security.rootAccess
  [refresh_expired_tokens] modules.security.rootAccess

gateway.modules.datamodels.datamodelChat
----------------------------------------
  [updateFromSelection] modules.datamodels.datamodelWorkflow

gateway.modules.features.aichat.mainAiChat
------------------------------------------
  [onStart] modules.aicore.aicoreModelRegistry

gateway.modules.features.automation.routeFeatureAutomation
----------------------------------------------------------
  [execute_automation] modules.services

gateway.modules.features.chatbot.datamodelFeatureChatbot
--------------------------------------------------------
  [updateFromSelection] modules.datamodels.datamodelWorkflow

gateway.modules.features.chatbot.interfaceFeatureChatbot
--------------------------------------------------------
  [createLog] modules.features.chatbot.eventManager
  [createMessage] modules.features.chatbot.eventManager
  [_enrichAutomationsWithUserAndMandate] modules.interfaces.interfaceDbApp
  [storeDebugMessageAndDocuments] modules.interfaces.interfaceDbManagement
  [setUserContext] modules.security.rootAccess
  [_notifyAutomationChanged] modules.shared.callbackRegistry
  [storeDebugMessageAndDocuments] modules.shared.debugLogger
  [deleteAutomationDefinition] modules.shared.eventManagement

gateway.modules.features.chatbot.mainChatbot
--------------------------------------------
  [_convert_file_ids_to_document_references] modules.interfaces.interfaceRbac

gateway.modules.features.neutralizer.mainNeutralizePlayground
-------------------------------------------------------------
  [processSharepointFiles] modules.services.serviceSharepoint.mainServiceSharepoint

gateway.modules.features.realestate.interfaceFeatureRealEstate
--------------------------------------------------------------
  [setUserContext] modules.security.rootAccess

gateway.modules.features.realestate.mainRealEstate
--------------------------------------------------
  [executeIntentBasedOperation] modules.features.realestate.datamodelFeatureRealEstate

gateway.modules.features.trustee.interfaceFeatureTrustee
--------------------------------------------------------
  [setUserContext] modules.security.rootAccess

gateway.modules.interfaces.interfaceBootstrap
---------------------------------------------
  [_applyDatabaseOptimizations] modules.shared.dbMultiTenantOptimizations

gateway.modules.interfaces.interfaceDbApp
-----------------------------------------
  [getRootInterface] modules.security.rootAccess

gateway.modules.interfaces.interfaceDbChat
------------------------------------------
  [_enrichAutomationsWithUserAndMandate] modules.interfaces.interfaceDbApp
  [storeDebugMessageAndDocuments] modules.interfaces.interfaceDbManagement
  [setUserContext] modules.security.rootAccess
  [_notifyAutomationChanged] modules.shared.callbackRegistry
  [storeDebugMessageAndDocuments] modules.shared.debugLogger

gateway.modules.interfaces.interfaceDbManagement
------------------------------------------------
  [_initializeStandardPrompts] modules.interfaces.interfaceDbApp
  [_initializeStandardPrompts] modules.security.rootAccess
  [setUserContext] modules.security.rootAccess

gateway.modules.interfaces.interfaceFeatures
--------------------------------------------
  [syncRolesFromTemplate] modules.datamodels.datamodelMembership

gateway.modules.interfaces.interfaceRbac
----------------------------------------
  [getRecordsetWithRBAC] modules.connectors.connectorDbPostgre

gateway.modules.interfaces.interfaceTicketObjects
-------------------------------------------------
  [createTicketInterfaceByType] modules.connectors.connectorTicketsClickup
  [createTicketInterfaceByType] modules.connectors.connectorTicketsJira

gateway.modules.routes.routeAdminAutomationEvents
-------------------------------------------------
  [sync_all_automation_events] modules.interfaces.interfaceDbApp
  [sync_all_automation_events] modules.services
  [get_all_automation_events] modules.shared.eventManagement
  [remove_event] modules.shared.eventManagement
  [sync_all_automation_events] modules.workflows.automation

gateway.modules.routes.routeAdminFeatures
-----------------------------------------
  [_getInstancePermissions] modules.datamodels.datamodelMembership
  [_getUserRoleInInstance] modules.datamodels.datamodelMembership
  [addUserToFeatureInstance] modules.datamodels.datamodelMembership
  [listFeatureInstanceUsers] modules.datamodels.datamodelMembership
  [removeUserFromFeatureInstance] modules.datamodels.datamodelMembership
  [updateFeatureInstanceUserRoles] modules.datamodels.datamodelMembership
  [_getInstancePermissions] modules.datamodels.datamodelRbac
  [_getUserRoleInInstance] modules.datamodels.datamodelRbac
  [_hasMandateAdminRole] modules.datamodels.datamodelRbac
  [getFeatureInstanceAvailableRoles] modules.datamodels.datamodelRbac
  [listFeatureInstanceUsers] modules.datamodels.datamodelRbac

gateway.modules.routes.routeDataUsers
-------------------------------------
  [delete_user] modules.datamodels.datamodelMembership
  [get_user] modules.datamodels.datamodelMembership
  [reset_user_password] modules.datamodels.datamodelMembership
  [sendPasswordLink] modules.datamodels.datamodelMembership
  [update_user] modules.datamodels.datamodelMembership
  [sendPasswordLink] modules.services
  [change_password] modules.shared.auditLogger
  [reset_user_password] modules.shared.auditLogger
  [sendPasswordLink] modules.shared.auditLogger
  [sendPasswordLink] modules.shared.configuration

gateway.modules.routes.routeDataWorkflows
-----------------------------------------
  [get_action_schema] modules.services
  [get_all_actions] modules.services
  [get_method_actions] modules.services
  [get_action_schema] modules.workflows.processing.shared.methodDiscovery
  [get_all_actions] modules.workflows.processing.shared.methodDiscovery
  [get_method_actions] modules.workflows.processing.shared.methodDiscovery

gateway.modules.routes.routeGdpr
--------------------------------
  [exportUserData] modules.datamodels.datamodelFeatures
  [deleteAccount] modules.datamodels.datamodelInvitation
  [exportUserData] modules.datamodels.datamodelInvitation
  [deleteAccount] modules.datamodels.datamodelMembership
  [exportPortableData] modules.datamodels.datamodelMembership
  [exportUserData] modules.datamodels.datamodelMembership
  [deleteAccount] modules.datamodels.datamodelSecurity

gateway.modules.routes.routeInvitations
---------------------------------------
  [createInvitation] modules.datamodels.datamodelFeatures
  [_hasMandateAdminRole] modules.datamodels.datamodelRbac
  [_isInstanceRole] modules.datamodels.datamodelRbac
  [createInvitation] modules.datamodels.datamodelRbac
  [registerAndAcceptInvitation] modules.security.passwordUtils
  [createInvitation] modules.shared.configuration
  [listInvitations] modules.shared.configuration

gateway.modules.routes.routeMessaging
-------------------------------------
  [_hasTriggerPermission] modules.interfaces.interfaceDbApp
  [triggerSubscription] modules.services

gateway.modules.routes.routeSecurityAdmin
-----------------------------------------
  [revoke_tokens_by_mandate] modules.datamodels.datamodelMembership

gateway.modules.routes.routeSecurityGoogle
------------------------------------------
  [auth_callback] modules.datamodels.datamodelSecurity
  [logout] modules.shared.auditLogger

gateway.modules.routes.routeSecurityLocal
-----------------------------------------
  [_sendAuthEmail] modules.datamodels.datamodelMessaging
  [_sendAuthEmail] modules.interfaces.interfaceMessaging
  [login] modules.shared.auditLogger
  [logout] modules.shared.auditLogger
  [passwordReset] modules.shared.auditLogger

gateway.modules.routes.routeSecurityMsft
----------------------------------------
  [logout] modules.shared.auditLogger

gateway.modules.security.rootAccess
-----------------------------------
  [_ensureBootstrap] modules.interfaces.interfaceBootstrap

gateway.modules.services.__init__
---------------------------------
  [__init__] modules.interfaces.interfaceDbApp
  [__init__] modules.interfaces.interfaceDbChat
  [__init__] modules.interfaces.interfaceDbManagement

gateway.modules.services.serviceAi.mainAiChat
---------------------------------------------
  [onStart] modules.aicore.aicoreModelRegistry

gateway.modules.services.serviceAi.mainServiceAi
------------------------------------------------
  [renderResult] modules.services.serviceGeneration.mainServiceGeneration
  [_handleCodeGeneration] modules.services.serviceGeneration.paths.codePath
  [_handleDocumentGeneration] modules.services.serviceGeneration.paths.documentPath
  [_handleImageGeneration] modules.services.serviceGeneration.paths.imagePath

gateway.modules.services.serviceAi.subContentExtraction
-------------------------------------------------------
  [extractTextFromImage] modules.datamodels.datamodelAi
  [processTextContentWithAi] modules.datamodels.datamodelAi

gateway.modules.services.serviceAi.subJsonResponseHandling
----------------------------------------------------------
  [mergeFragmentIntoSection] modules.shared.debugLogger

gateway.modules.services.serviceAi.subStructureFilling
------------------------------------------------------
  [_getAcceptedSectionTypesForFormat] modules.datamodels.datamodelJson
  [_getAcceptedSectionTypesForFormat] modules.services.serviceGeneration.renderers.registry
  [buildSectionPromptWithContinuation] modules.shared.jsonContinuation
  [_extractAndMergeMultipleJsonBlocks] modules.shared.jsonUtils
  [_processAiResponseForSection] modules.shared.jsonUtils
  [_processSingleSection] modules.shared.jsonUtils

gateway.modules.services.serviceAi.subStructureGeneration
---------------------------------------------------------
  [generateStructure] modules.services.serviceGeneration.renderers.registry
  [generateStructure] modules.shared
  [generateStructure] modules.shared.jsonContinuation

gateway.modules.services.serviceChat.mainServiceChat
----------------------------------------------------
  [getChatDocumentsFromDocumentList] modules.datamodels.datamodelDocref

gateway.modules.services.serviceExtraction.mainServiceExtraction
----------------------------------------------------------------
  [extractContent] modules.interfaces.interfaceDbManagement
  [extractContent] modules.shared.debugLogger

gateway.modules.services.serviceExtraction.subPromptBuilderExtraction
---------------------------------------------------------------------
  [buildExtractionPrompt] modules.shared.debugLogger

gateway.modules.services.serviceGeneration.mainServiceGeneration
----------------------------------------------------------------
  [getAdaptiveExtractionPrompt] modules.services.serviceExtraction.subPromptBuilderExtraction
  [renderReport] modules.services.serviceGeneration.renderers.registry
  [generateDocumentWithTwoPhases] modules.services.serviceGeneration.subContentGenerator
  [generateDocumentWithTwoPhases] modules.services.serviceGeneration.subStructureGenerator

gateway.modules.services.serviceGeneration.paths.codePath
---------------------------------------------------------
  [generateCode] modules.datamodels.datamodelDocument
  [_getCodeRenderer] modules.services.serviceGeneration.renderers.registry
  [_generateCodeStructure] modules.shared.jsonContinuation
  [_generateSingleFileContent] modules.shared.jsonContinuation

gateway.modules.services.serviceGeneration.renderers.rendererDocx
-----------------------------------------------------------------
  [getAcceptedSectionTypes] modules.datamodels.datamodelJson

gateway.modules.services.serviceGeneration.renderers.rendererHtml
-----------------------------------------------------------------
  [getAcceptedSectionTypes] modules.datamodels.datamodelJson

gateway.modules.services.serviceGeneration.renderers.rendererImage
------------------------------------------------------------------
  [_compressPromptWithAi] modules.datamodels.datamodelAi
  [_generateAiImage] modules.datamodels.datamodelAi

gateway.modules.services.serviceGeneration.renderers.rendererJson
-----------------------------------------------------------------
  [getAcceptedSectionTypes] modules.datamodels.datamodelJson

gateway.modules.services.serviceGeneration.renderers.rendererMarkdown
---------------------------------------------------------------------
  [getAcceptedSectionTypes] modules.datamodels.datamodelJson

gateway.modules.services.serviceGeneration.renderers.rendererPdf
----------------------------------------------------------------
  [_getAiStylesWithPdfColors] modules.datamodels.datamodelAi
  [getAcceptedSectionTypes] modules.datamodels.datamodelJson

gateway.modules.services.serviceGeneration.renderers.rendererPptx
-----------------------------------------------------------------
  [getAcceptedSectionTypes] modules.datamodels.datamodelJson

gateway.modules.services.serviceGeneration.renderers.rendererText
-----------------------------------------------------------------
  [getAcceptedSectionTypes] modules.datamodels.datamodelJson

gateway.modules.services.serviceGeneration.renderers.rendererXlsx
-----------------------------------------------------------------
  [_getAiStylesWithExcelColors] modules.datamodels.datamodelAi
  [getAcceptedSectionTypes] modules.datamodels.datamodelJson

gateway.modules.services.serviceGeneration.subContentGenerator
--------------------------------------------------------------
  [_generateImageSection] modules.datamodels.datamodelAi
  [_generateSimpleSection] modules.datamodels.datamodelAi
  [_generateSimpleSection] modules.shared.jsonUtils

gateway.modules.services.serviceGeneration.subStructureGenerator
----------------------------------------------------------------
  [generateStructure] modules.datamodels.datamodelAi

gateway.modules.services.serviceUtils.mainServiceUtils
------------------------------------------------------
  [storeDebugMessageAndDocuments] modules.interfaces.interfaceDbChat
  [debugLogToFile] modules.shared.debugLogger
  [writeDebugArtifact] modules.shared.debugLogger
  [writeDebugFile] modules.shared.debugLogger

gateway.modules.shared.auditLogger
----------------------------------
  [_ensureInitialized] modules.datamodels.datamodelAudit
  [cleanupOldEntries] modules.datamodels.datamodelAudit
  [getAuditLogs] modules.datamodels.datamodelAudit
  [logEvent] modules.datamodels.datamodelAudit
  [registerAuditLogCleanupScheduler] modules.shared.eventManagement

gateway.modules.shared.debugLogger
----------------------------------
  [debugLogToFile] modules.shared.timeUtils

gateway.modules.shared.jsonUtils
--------------------------------
  [buildContinuationContext] modules.shared.jsonContinuation

gateway.modules.workflows.automation.subAutomationSchedule
----------------------------------------------------------
  [start] modules.shared.callbackRegistry
  [start] modules.workflows.automation

gateway.modules.workflows.methods.methodAi.actions.generateCode
---------------------------------------------------------------
  [generateCode] modules.datamodels.datamodelDocref

gateway.modules.workflows.methods.methodAi.actions.generateDocument
-------------------------------------------------------------------
  [generateDocument] modules.datamodels.datamodelDocref

gateway.modules.workflows.methods.methodAi.actions.process
----------------------------------------------------------
  [process] modules.datamodels.datamodelDocref
  [process] modules.datamodels.datamodelWorkflow

gateway.modules.workflows.methods.methodChatbot.actions.queryDatabase
---------------------------------------------------------------------
  [queryDatabase] modules.datamodels.datamodelDocref

gateway.modules.workflows.methods.methodOutlook.actions.composeAndDraftEmailWithContext
---------------------------------------------------------------------------------------
  [composeAndDraftEmailWithContext] modules.datamodels.datamodelDocref

gateway.modules.workflows.methods.methodOutlook.actions.sendDraftEmail
----------------------------------------------------------------------
  [sendDraftEmail] modules.datamodels.datamodelDocref

gateway.modules.workflows.methods.methodSharepoint.actions.copyFile
-------------------------------------------------------------------
  [copyFile] modules.datamodels.datamodelDocref

gateway.modules.workflows.methods.methodSharepoint.actions.downloadFileByPath
-----------------------------------------------------------------------------
  [downloadFileByPath] modules.datamodels.datamodelDocref

gateway.modules.workflows.methods.methodSharepoint.actions.uploadFile
---------------------------------------------------------------------
  [uploadFile] modules.datamodels.datamodelDocref

gateway.modules.workflows.methods.methodSharepoint.helpers.documentParsing
--------------------------------------------------------------------------
  [parseDocumentListForFolder] modules.datamodels.datamodelDocref
  [parseDocumentListForFoundDocuments] modules.datamodels.datamodelDocref

gateway.modules.workflows.processing.core.actionExecutor
--------------------------------------------------------
  [_createActionCompletionMessage] modules.workflows.processing.core.messageCreator

gateway.modules.workflows.processing.modes.modeDynamic
------------------------------------------------------
  [_actExecute] modules.datamodels.datamodelAi
  [_planSelect] modules.datamodels.datamodelAi
  [_refineDecide] modules.datamodels.datamodelAi
  [_actExecute] modules.datamodels.datamodelDocref
  [_planSelect] modules.datamodels.datamodelDocref
  [_actExecute] modules.datamodels.datamodelWorkflow
  [_planSelect] modules.datamodels.datamodelWorkflow
  [_actExecute] modules.shared.jsonUtils
  [_planSelect] modules.shared.jsonUtils
  [_refineDecide] modules.shared.jsonUtils
  [_actExecute] modules.workflows.processing.shared.methodDiscovery

gateway.modules.workflows.processing.shared.placeholderFactory
--------------------------------------------------------------
  [extractReviewContent] modules.datamodels.datamodelChat
  [extractLatestRefinementFeedback] modules.interfaces.interfaceDbApp
  [extractLatestRefinementFeedback] modules.interfaces.interfaceDbChat

gateway.modules.workflows.workflowManager
-----------------------------------------
  [_executeTasks] modules.datamodels.datamodelWorkflow
  [workflowStart] modules.workflows.processing.shared.methodDiscovery
  [_checkIfHistoryAvailable] modules.workflows.processing.shared.placeholderFactory


================================================================================
CIRCULAR DEPENDENCY (must stay in function)
================================================================================

gateway.modules.shared.auditLogger
----------------------------------
  [_ensureInitialized] modules.connectors.connectorDbPostgre

gateway.modules.shared.configuration
------------------------------------
  [decryptValue] modules.shared.auditLogger
  [encryptValue] modules.shared.auditLogger
  [get] modules.shared.auditLogger