package metric

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

var (
	// ProjectMigrationTaskDuration tracks how long each project-migration DAG takes to complete.
	// It is recorded once per successful DAG run.
	ProjectMigrationTaskDuration = prometheus.NewHistogramVec(
		prometheus.HistogramOpts{
			Namespace: "project_migration",
			Name:      "task_duration_seconds",
			Help:      "Duration (seconds) of a project-migration workflow run from start to completion.",
			Buckets:   prometheus.ExponentialBucketsRange(60, 60*60*24, 10), // 1 min to 24 h
		},
		[]string{"org_id"},
	)

	// ProjectMigrationClustersTotal counts the number of clusters processed per migration step.
	ProjectMigrationClustersTotal = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Namespace: "project_migration",
			Name:      "clusters_total",
			Help:      "Number of clusters processed during project-migration, partitioned by outcome.",
		},
		[]string{"org_id", "source_project_id", "result"}, // result: "success" | "failure"
	)
)

func init() {
	prometheus.MustRegister(ProjectMigrationTaskDuration)
	prometheus.MustRegister(ProjectMigrationClustersTotal)
}
