package routes import ( "bugulma/backend/internal/handler" "bugulma/backend/internal/service" "github.com/gin-gonic/gin" ) // RegisterAllRoutes registers all application routes organized by domain func RegisterAllRoutes( router *gin.Engine, orgHandler *handler.OrganizationHandler, siteHandler *handler.SiteHandler, resourceHandler *handler.ResourceFlowHandler, proposalHandler *handler.ProposalHandler, matchingHandler *handler.MatchingHandler, authHandler *handler.AuthHandler, sharedAssetHandler *handler.SharedAssetHandler, geospatialHandler *handler.GeospatialHandler, analyticsHandler *handler.AnalyticsHandler, aiHandler *handler.AIHandler, heritageHandler *handler.HeritageHandler, graphHandler *handler.GraphHandler, graphTraversalHandler *handler.GraphTraversalHandler, websocketService *service.WebSocketService, ) { // Public routes (no authentication required) public := router.Group("/api/v1") // Additional public routes for compatibility apiRoutes := router.Group("/api") // Protected routes (authentication required) protected := router.Group("/api/v1") // TODO: Add authentication middleware when available // Register routes by domain RegisterAuthRoutes(public, authHandler) RegisterUserRoutes(protected, orgHandler) RegisterOrganizationRoutes(public, protected, orgHandler) RegisterSiteRoutes(public, protected, siteHandler) RegisterResourceRoutes(public, protected, resourceHandler) RegisterProposalRoutes(public, protected, proposalHandler) RegisterMatchingRoutes(public, protected, matchingHandler) RegisterSharedAssetRoutes(public, protected, sharedAssetHandler) RegisterGeospatialRoutes(public, geospatialHandler) RegisterAnalyticsRoutes(public, analyticsHandler) RegisterAIRoutes(public, aiHandler) RegisterHeritageRoutes(public, heritageHandler) RegisterGraphRoutes(public, protected, graphHandler, graphTraversalHandler) // Register graph routes under /api for frontend compatibility RegisterGraphRoutesForAPI(apiRoutes, graphHandler) RegisterWebSocketRoutes(protected, websocketService) } // RegisterGraphRoutesForAPI registers graph routes under /api path for frontend compatibility func RegisterGraphRoutesForAPI(apiRoutes *gin.RouterGroup, graphHandler *handler.GraphHandler) { // Public read-only routes under /api for frontend compatibility if graphHandler != nil { graph := apiRoutes.Group("/graph") { graph.GET("/organizations/:organizationId/network", graphHandler.GetOrganizationNetwork) graph.GET("/shortest-path", graphHandler.FindShortestPath) graph.GET("/spatial-proximity", graphHandler.GetSpatialProximity) graph.GET("/matching-opportunities", graphHandler.GetMatchingOpportunities) graph.GET("/statistics", graphHandler.GetGraphStatistics) } } }