package facade

import (
	"context"
	"time"

	"github.com/tidbcloud/serverless-service/internal/domain/constant"
	tidbmgmtservicev1 "github.com/tidbcloud/tidb-management-service/api/spec/tidb_mgmt_service/v1"
)

type DowntimeRes struct {
	DownRate    float64
	Connections float64
}

type O11yFacade interface {
	GetClusterSkuUsageByRegion(
		ctx context.Context,
		clusterId string,
		keyspaceId uint32,
		o11yAddr string,
	) (map[string]float64, error)
	GetBranchesSkuUsagesByRegion(
		ctx context.Context,
		keyspaceIds []uint32,
		metricType constant.MetricType,
		o11yAddr string,
	) (map[string]float64, error)
	GetDowntimes(ctx context.Context, o11yAddr string) (result map[string]DowntimeRes, err error)
	GetProvisionedRCU(ctx context.Context, o11yAddr string) (map[uint64]uint64, error)
	GetExportUsage(
		ctx context.Context,
		exportID, o11yAddr string,
		completedAt time.Time,
		metricType constant.MetricType,
	) (int64, error)
	GetSQLiteDBFileFromS3(ctx context.Context, region string, keySuffix string) (string, string, error)
	GetClusterRowStorage(ctx context.Context, cluster *tidbmgmtservicev1.Cluster) (int64, error)
}
