import type { ObservabilityConfig, ObservabilityTarget } from "./types";

export type MetricsTargetDisposition = "enabled" | "disabled" | "disabled-for-target";

export function metricsTargetDisposition(observability: ObservabilityConfig, target: ObservabilityTarget): MetricsTargetDisposition {
  if (!observability.metricsBackend.enabled) return "disabled";
  return observability.metricsBackend.targetIds.some((targetId) => targetId.toLowerCase() === target.id.toLowerCase()) ? "enabled" : "disabled-for-target";
}

export function metricsEnabledForTarget(observability: ObservabilityConfig, target: ObservabilityTarget): boolean {
  return metricsTargetDisposition(observability, target) === "enabled";
}
