package framework

const InputInterfaceV1IdStr InputInterfaceVersion = "InputInterfaceV1"

type ClusterComponentV1 struct {
	Name     InstanceName
	Type     InstanceType
	Replicas uint
}

type ClusterTopologyV1 map[InstanceName]ClusterComponentV1

func (this ClusterTopologyV1) Equal(another ClusterTopologyV1) bool {
	if len(this) != len(another) {
		return false
	}
	for name, componentA := range this {
		componentB, ok := another[name]
		if !ok {
			return false
		}
		if componentA.Name != componentB.Name ||
			componentA.Type != componentB.Type ||
			componentA.Replicas != componentB.Replicas {
			return false
		}
	}
	return true
}

const InstanceNameMock InstanceName = "TiDBMockComponent"
const InstanceTypeMock InstanceType = "8C128G"

var ClusterTopologyV1Mock = ClusterTopologyV1{
	InstanceNameMock: ClusterComponentV1{
		Name:     InstanceNameMock,
		Type:     InstanceTypeMock,
		Replicas: 2,
	},
}

// this interface is not bonded to any cluster when it's created
type InputInterfaceV1 interface {
	GetRangeMetrics(clusterId ClusterId, name MetricName, fromTo TimeRange) (MetricTimeValueInt64s, error)
	GetClusterTopology(clusterId ClusterId) (ClusterTopologyV1, error)
}
