# app/modules/customers/definition.py """ Customers module definition. Defines the customers module including its features, menu items, route configurations, and self-contained module settings. """ from app.modules.base import ModuleDefinition from models.database.admin_menu_config import FrontendType def _get_admin_router(): """Lazy import of admin router to avoid circular imports.""" from app.modules.customers.routes.admin import admin_router return admin_router def _get_vendor_router(): """Lazy import of vendor router to avoid circular imports.""" from app.modules.customers.routes.vendor import vendor_router return vendor_router # Customers module definition customers_module = ModuleDefinition( code="customers", name="Customer Management", description="Customer database, profiles, addresses, and segmentation.", version="1.0.0", features=[ "customer_view", # View customer profiles "customer_export", # Export customer data "customer_profiles", # Detailed customer profiles "customer_segmentation", # Customer tagging and segments "customer_addresses", # Address management "customer_authentication", # Customer login/registration ], menu_items={ FrontendType.ADMIN: [ "customers", # Platform-wide customer view ], FrontendType.VENDOR: [ "customers", # Vendor customer list ], }, is_core=True, # Customers is a core module - customer data is fundamental # ========================================================================= # Self-Contained Module Configuration # ========================================================================= is_self_contained=True, services_path="app.modules.customers.services", models_path="app.modules.customers.models", schemas_path="app.modules.customers.schemas", exceptions_path="app.modules.customers.exceptions", ) def get_customers_module_with_routers() -> ModuleDefinition: """ Get customers module with routers attached. This function attaches the routers lazily to avoid circular imports during module initialization. """ customers_module.admin_router = _get_admin_router() customers_module.vendor_router = _get_vendor_router() return customers_module __all__ = ["customers_module", "get_customers_module_with_routers"]