package handler import ( "net/http" "bugulma/backend/internal/service" "github.com/gin-gonic/gin" ) type AdminHandler struct { adminService *service.AdminService } func NewAdminHandler(adminService *service.AdminService) *AdminHandler { return &AdminHandler{ adminService: adminService, } } // GetDashboardStats returns dashboard statistics (admin only) // @Summary Get dashboard statistics // @Tags admin // @Produce json // @Success 200 {object} service.DashboardStats // @Router /api/v1/admin/dashboard/stats [get] func (h *AdminHandler) GetDashboardStats(c *gin.Context) { stats, err := h.adminService.GetDashboardStats(c.Request.Context()) if err != nil { c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()}) return } c.JSON(http.StatusOK, stats) } // GetOrganizationStats returns organization analytics (admin only) // @Summary Get organization statistics // @Tags admin // @Produce json // @Success 200 {object} service.OrganizationStats // @Router /api/v1/admin/analytics/organizations [get] func (h *AdminHandler) GetOrganizationStats(c *gin.Context) { stats, err := h.adminService.GetOrganizationStats(c.Request.Context(), nil) if err != nil { c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()}) return } c.JSON(http.StatusOK, stats) } // GetUserActivityStats returns user activity analytics (admin only) // @Summary Get user activity statistics // @Tags admin // @Produce json // @Success 200 {object} service.UserActivityStats // @Router /api/v1/admin/analytics/users [get] func (h *AdminHandler) GetUserActivityStats(c *gin.Context) { stats, err := h.adminService.GetUserActivityStats(c.Request.Context(), nil) if err != nil { c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()}) return } c.JSON(http.StatusOK, stats) } // GetMatchingStats returns matching analytics (admin only) // @Summary Get matching statistics // @Tags admin // @Produce json // @Success 200 {object} service.MatchingStats // @Router /api/v1/admin/analytics/matching [get] func (h *AdminHandler) GetMatchingStats(c *gin.Context) { stats, err := h.adminService.GetMatchingStats(c.Request.Context(), nil) if err != nil { c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()}) return } c.JSON(http.StatusOK, stats) } // GetSystemHealth returns system health metrics (admin only) // @Summary Get system health // @Tags admin // @Produce json // @Success 200 {object} service.SystemHealth // @Router /api/v1/admin/system/health [get] func (h *AdminHandler) GetSystemHealth(c *gin.Context) { health, err := h.adminService.GetSystemHealth(c.Request.Context()) if err != nil { c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()}) return } c.JSON(http.StatusOK, health) } // GetRecentActivity returns recent activity logs (admin only) // @Summary Get recent activity // @Tags admin // @Produce json // @Success 200 {array} object // @Router /api/v1/admin/dashboard/activity [get] func (h *AdminHandler) GetRecentActivity(c *gin.Context) { // TODO: Implement when ActivityService is integrated with AdminService // For now, return empty array c.JSON(http.StatusOK, []interface{}{}) }