package operator

import (
	"net/http"
)

// healthHandler implements basic health check endpoints
type healthHandler struct {
	operator *Operator
}

func (h *healthHandler) healthz(w http.ResponseWriter, r *http.Request) {
	w.WriteHeader(http.StatusOK)
}

func (h *healthHandler) readyz(w http.ResponseWriter, r *http.Request) {
	// Check MongoDB connection
	if err := h.operator.mongodb.Ping(r.Context(), nil); err != nil {
		http.Error(w, "MongoDB not ready", http.StatusServiceUnavailable)
		return
	}
	w.WriteHeader(http.StatusOK)
}
