# app/modules/cms/definition.py """ CMS module definition. Defines the CMS module including its features, menu items, and route configurations. """ 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.cms.routes.admin import admin_router return admin_router def _get_vendor_router(): """Lazy import of vendor router to avoid circular imports.""" from app.modules.cms.routes.vendor import vendor_router return vendor_router # CMS module definition cms_module = ModuleDefinition( code="cms", name="Content Management", description="Content pages, media library, and vendor themes.", features=[ "cms_basic", # Basic page editing "cms_custom_pages", # Custom page creation "cms_unlimited_pages", # No page limit "cms_templates", # Page templates "cms_seo", # SEO tools "media_library", # Media file management ], menu_items={ FrontendType.ADMIN: [ "content-pages", # Platform content pages "vendor-themes", # Theme management ], FrontendType.VENDOR: [ "content-pages", # Vendor content pages "media", # Media library ], }, is_core=False, ) def get_cms_module_with_routers() -> ModuleDefinition: """ Get CMS module with routers attached. This function attaches the routers lazily to avoid circular imports during module initialization. """ cms_module.admin_router = _get_admin_router() cms_module.vendor_router = _get_vendor_router() return cms_module __all__ = ["cms_module", "get_cms_module_with_routers"]