package infra_metrics

import (
	"context"
	"time"

	"github.com/tidbcloud/core-svc/idl/pbgen/proto/core"
	"github.com/tidbcloud/pkgv2/bizerr"
)

type PromSQLType string

const (
	QueryPromSQLType      PromSQLType = "query"
	QueryRangePromSQLType PromSQLType = "query_range"
)

type O11yCluster struct {
	ApplicationID string `json:"applicationID"`
	BizType       string `json:"bizType"`
	ID            string `json:"id"`
	ProjectID     string `json:"projectID"`
	Region        string `json:"region"`
	TenantID      string `json:"tenantID"`
	Vendor        string `json:"vendor"`
}

type O11yClusterResponse struct {
	Code int  `json:"code"`
	Data Data `json:"data"`
}

type Data struct {
	Clusters []O11yCluster `json:"clusters"`
}

type InfraMetrics interface {
	QueryClusterMetrics(ctx context.Context, cluster *core.Cluster, expr string, time time.Time) ([]byte, bizerr.BizError)
	QueryRangeClusterMetrics(ctx context.Context, cluster *core.Cluster, expr string) ([]byte, bizerr.BizError)
	QueryClusterMetricsWithParam(
		ctx context.Context, cluster *core.Cluster, expr string, params map[string]string) ([]byte, bizerr.BizError)
}
