package framework

import (
	"fmt"
	"time"
)

// range type: [...)
type TimeRange struct {
	From time.Time
	To   time.Time
}

func NewTimeRangeLatest(latestDuration time.Duration) TimeRange {
	now := time.Now()
	return TimeRange{
		From: now.Add(-latestDuration),
		To:   now,
	}
}

func (this TimeRange) String() string {
	return fmt.Sprintf("[%s~%s)", this.From.Format(time.RFC3339), this.To.Format(time.RFC3339))
}

type MetricName string

type InputProviderType string

// this version is the golang-interface version,
// for example: `InputInterfaceV1` in this package
type InputInterfaceVersion string

type InputProviderMeta struct {
	Type             InputProviderType
	InterfaceVersion InputInterfaceVersion
}

func (this *InputProviderMeta) String() string {
	return fmt.Sprintf("Type:%s;InterfaceVersion:%s", this.Type, this.InterfaceVersion)
}

type MetricValueInt64 int64

type MetricValuesInt64s []MetricValueInt64

type MetricTimeValueInt64 struct {
	Time  time.Time
	Value MetricValueInt64
}

type MetricTimeValueInt64s []MetricTimeValueInt64

// ---

type ClusterId string

type InstanceName string

type InstanceType string
