package httpapi

import (
	"testing"

	"github.com/easyai/easyai-ai-gateway/apps/api/internal/clients"
)

func TestRunErrorDetailsExposeStructuredClientFailure(t *testing.T) {
	err := &clients.ClientError{
		Code:    "gemini_image_output_missing",
		Message: "Gemini image response contains no extractable image: prompt blocked",
		Details: map[string]any{
			"provider":          "gemini",
			"reason":            "prompt_blocked",
			"promptBlockReason": "SAFETY",
		},
	}

	details := runErrorDetails(err)
	if details["provider"] != "gemini" ||
		details["reason"] != "prompt_blocked" ||
		details["promptBlockReason"] != "SAFETY" {
		t.Fatalf("public error details lost Gemini extraction diagnostics: %+v", details)
	}
}
