package _const

type TaskType int

const (
	UnsupportTask TaskType = iota
	MetricTask
	LogTask
	SlowLogTask
	RebuildConfTask
	ReportTask
	AllTask
	MetricsAndConfTask
)

func TaskTypeString(t TaskType) string {
	if t == MetricTask {
		return "metric"
	}

	if t == LogTask {
		return "log"
	}

	if t == RebuildConfTask {
		return "exclude log and metrics"
	}

	return "unknown task type"
}

func (t TaskType) Validate() bool {
	return t <= MetricsAndConfTask && t > UnsupportTask
}

func AllTaskType() []TaskType {
	return []TaskType{
		MetricTask,
		LogTask,
		RebuildConfTask,
	}
}

const (
	ClusterIDParameter         = "clusterID"
	ClusterTypeParameter       = "clusterType"
	ClusterRebuildParameter    = "rebuild"
	ClusterBegineTimeParameter = "begineTime"
	ClusterEndTimeParameter    = "endTime"
	ClusterNameParameter       = "clusterName"
	ClusterDirSize             = "clusterDirSize"

	// TODO(shenjun): Rename to TaskManager later
	ImporterRebuild        = "/task_manager/api/v1/rebuild"
	ImporterTaskStatus     = "/task_manager/api/v1/status"
	ImporterFileTaskStatus = "/task_manager/api/v1/%s/status"

	UploadPrecreatePath = "/upload/api/v1/files/precreate"
	UploadPath          = "/upload/api/v1/files/upload"
	UploadFlushPath     = "/upload/api/v1/files/flush"
	DecryptPath         = "/upload/api/v1/files/decrypt"

	ReportGetRealTimeReportPath = "/tasks/realtime-diag-summary/sync"
	ReportRealTimeFeedbackPath  = "/tasks/diag-rule-feedback/sync"
	ReportActivePath            = "/tasks/active-cluster/async"

	MaxFileSizePreClusterInBytes = 50 * 1024 * 1024 * 1024 // 50GB max file size in IEC
)
