package dto

import (
	pmodel "github.com/prometheus/common/model"
)

type MetricsQueryTopic int

const (
	ConstMetricsQueryTopicCountReq MetricsQueryTopic = iota + 1
	ConstMetricsQueryTopicCountError
	ConstMetricsQueryTopicCountUnauth
	ConstMetricsQueryTopicSumLatency
	ConstMetricsQueryTopicPT99Latency
	ConstMetricsQueryTopicTopKReq
	ConstMetricsQueryTopicTopKError
	ConstMetricsQueryTopicTopKLantency
)

type PromQueryReq struct {
	Start         uint64            `json:"start"`
	End           uint64            `json:"end"`
	Step          pmodel.Duration   `json:"step"`
	DataAppExtId  string            `json:"dataapp_ext_id"`
	RangeSelector pmodel.Duration   `json:"range_selector"`
	TopK          uint64            `json:"topk"`
	QueryTopic    MetricsQueryTopic `json:"topic"`
	Org           string            `json:"org"`
}

type PromQueryParam struct {
	PromQl string
	PromQueryReq
}

type PromStream struct {
	Metric map[string]string   `json:"metric"`
	Values []pmodel.SamplePair `json:"values"`
	Value  pmodel.SamplePair   `json:"value"`
}

type PromQueryData struct {
	ResultType string       `json:"result_type"`
	Result     []PromStream `json:"result"`
}

type PromQueryRes struct {
	Status string        `json:"status"`
	Data   PromQueryData `json:"data"`
}
