package metrics

import (
	"github.com/prometheus/client_golang/prometheus"
)

type PlatformProberMetrics struct {
	DescClusterExist *prometheus.Desc
}

func NewPlatformProberMetrics(clusterID, projectID string) *PlatformProberMetrics {
	m := &PlatformProberMetrics{}

	constLabels := map[string]string{
		"cluster_id": clusterID,
		"project_id": projectID,
	}
	m.DescClusterExist = prometheus.NewDesc(
		m.fqName("cluster_exist"),
		"Whether the cluster is exist in the platform.",
		nil,
		constLabels,
	)

	return m
}

func (m *PlatformProberMetrics) Desc() []*prometheus.Desc {
	return []*prometheus.Desc{
		m.DescClusterExist,
	}
}

func (m *PlatformProberMetrics) ClusterExist(exist bool) prometheus.Metric {
	return prometheus.MustNewConstMetric(
		m.DescClusterExist,
		prometheus.GaugeValue, GaugeBool(exist),
	)
}

func (m *PlatformProberMetrics) fqName(name string) string {
	return prometheus.BuildFQName(Namespace, PlatformProberSubsystem, name)
}
