package handlers

import (

)

// ------------------------------------
// Handler: QueryComparison
// http://127.0.0.1:8087/traffic-mirroring/query-comparison"
// ------------------------------------
// func SqlCheck(c *gin.Context) {
// 	ctx := c.Request.Context()

// 	var req mydto.SqlCheckRequest
// 	if err := c.ShouldBindJSON(&req); err != nil {
// 		c.JSON(http.StatusBadRequest, myerr.NewBadRequestErr(err.Error()))
// 		return
// 	}
// 	// err := service.SetClusterBasicInfo(ctx, &req)
// 	// if err != nil {
// 	// 	log.Warn(ctx, "SetClusterBasicInfo  warn", zap.Error(err))
// 	// 	c.JSON(http.StatusBadRequest, myerr.NewBadRequestErr(err.Error()))
// 	// 	return
// 	// }

// 	 err := validateSqlCheckParams(req)
// 	if err != nil {
// 		log.Warn(ctx, "validateSqlCheckParams  warn", zap.Error(err))
// 		c.JSON(http.StatusBadRequest, myerr.NewBadRequestErr(err.Error()))
// 		return
		
// 	}

// 	diffParam := mydto.QueryComparisonRequest{
// 		ClusterA: mydto.ClusterSideDTO{
// 			ClusterId: req.ClusterId,
// 			TimeRange: req.TimeRangeA,
// 			ClusterUrls: req.ClusterUrls,
// 			Provider: req.Provider,
// 			Region: req.Region,
// 			DeployType: req.DeployType,
// 			TenantID: req.TenantID,
// 		},
// 		ClusterB: mydto.ClusterSideDTO{
// 			ClusterId: req.ClusterId,
// 			TimeRange: req.TimeRangeB,
// 			ClusterUrls: req.ClusterUrls,
// 			Provider: req.Provider,
// 			Region: req.Region,
// 			DeployType: req.DeployType,
// 			TenantID: req.TenantID,
// 		},
// 		Options: mydto.QueryComparisonOptions{
// 			TopN:           req.TopN,
// 			DigestDiffKeys: req.DigestDiffKeys,
// 			DigestSources:  req.DigestSources,
// 		},
// 	}

//  	s3Path := fmt.Sprintf("healthcheck-report/%s_%s_sqlcheck.json", req.ClusterId, req.ReportId)
// 	go  ClusterSqlCheck(ctx, diffParam, s3Path)
// 	// if err != nil {
// 	// 	log.Error(ctx, "ClusterSqlDiff  warn", zap.Error(err))
// 	// 	c.JSON(http.StatusInternalServerError, myerr.NewInternalErr(err.Error()))
// 	// 	return
// 	// }

// 	log.Info(ctx, "SqlCheck request success", zap.String("clusterId", req.ClusterId), zap.String("reportId", req.ReportId))
// 	c.JSON(http.StatusOK, "success")
// }

// func validateSqlCheckParams( req mydto.SqlCheckRequest)  error {

// 	// 1) check Cluster A time range

// 	if req.TimeRangeA.Start.After(req.TimeRangeA.End) {
// 		return fmt.Errorf("invalid clusterA.timeRange.end")
// 	}
// 	// 2) check Cluster B time range
// 	if req.TimeRangeB.Start.After(req.TimeRangeB.End) {
// 		return fmt.Errorf("invalid clusterB.timeRange.end")
// 	}

// 	// 3) cluster id
// 	if req.ClusterId == "" {
// 		return fmt.Errorf("cluster_id required")
// 	}


// 	// 4) TopN
// 	topN := req.TopN
// 	if topN <= 0 {
// 		topN = service.DefaultTopN()
// 	}



// 	return nil

// }
