package metrics

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

// Global Prometheus metrics
var (
	EmbeddingAPISuccess = promauto.NewCounterVec(
		prometheus.CounterOpts{
			Name: "embedding_api_success_total",
			Help: "Total number of successful embedding API calls",
		},
		[]string{"model"},
	)

	EmbeddingAPIFailure = promauto.NewCounterVec(
		prometheus.CounterOpts{
			Name: "embedding_api_failure_total",
			Help: "Total number of failed embedding API calls",
		},
		[]string{"model", "reason"},
	)

	EmbeddingAPIUsedMicroDollars = promauto.NewCounterVec(
		prometheus.CounterOpts{
			Name: "embedding_api_used_micro_dollars_total",
			Help: "Total micro-dollars used by embedding API calls",
		},
		[]string{"model"},
	)

	EmbeddingAPILatency = promauto.NewHistogramVec(
		prometheus.HistogramOpts{
			Name:    "embedding_api_latency_seconds",
			Help:    "End-to-end latency of embedding API calls in seconds",
			Buckets: prometheus.DefBuckets,
		},
		[]string{"model"},
	)

	EmbeddingProviderLatency = promauto.NewHistogramVec(
		prometheus.HistogramOpts{
			Name:    "embedding_provider_latency_seconds",
			Help:    "Latency of embedding provider calls in seconds",
			Buckets: prometheus.DefBuckets,
		},
		[]string{"model"},
	)
)
