package handlers

import (
	"net/http"

	"cmr-backend/internal/httpx"
	"cmr-backend/internal/service"
)

type OpsSummaryHandler struct {
	service *service.OpsSummaryService
}

func NewOpsSummaryHandler(service *service.OpsSummaryService) *OpsSummaryHandler {
	return &OpsSummaryHandler{service: service}
}

func (h *OpsSummaryHandler) GetOverview(w http.ResponseWriter, r *http.Request) {
	result, err := h.service.GetOverview(r.Context())
	if err != nil {
		httpx.WriteError(w, err)
		return
	}
	httpx.WriteJSON(w, http.StatusOK, map[string]any{"data": result})
}
