package system

import (
	"net/http"

	"github.com/gin-gonic/gin"

	"github.com/tidbcloud/AgentTeam/desktop/internal/doctor"
)

// DoctorHandler handles diagnostic check requests.
type DoctorHandler struct{}

// NewDoctorHandler creates a new DoctorHandler.
func NewDoctorHandler() gin.HandlerFunc {
	return (&DoctorHandler{}).Handle
}

// Handle runs all diagnostic checks and returns the results.
func (h *DoctorHandler) Handle(c *gin.Context) {
	results := doctor.RunChecks(nil)
	c.JSON(http.StatusOK, doctor.DoctorResponse{Results: results})
}
