/*
 * Copyright OpenSearch Contributors
 * SPDX-License-Identifier: Apache-2.0
 */

import React from 'react';
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
const STATUS_COLORS = {
  ok: 'var(--osd-color-status-ok, #22C55E)',
  warning: 'var(--osd-color-status-warning, #EAB308)',
  error: 'var(--osd-color-status-error, #EF4444)',
  critical: 'var(--osd-color-status-critical, #DC2626)',
  unknown: 'var(--osd-color-status-unknown, #6B7280)'
};
const STATUS_ICONS = {
  ok: '\u2713',
  // checkmark
  warning: '\u26A0',
  // warning triangle
  error: '\u2716',
  // X mark
  critical: '\u2716',
  // X mark
  unknown: '\u2014' // em dash
};

/**
 * Universal status indicator. Renders a colored icon (or custom icon) with an
 * optional text label. Replaces hardcoded SLI status icon logic.
 */
export const StatusIndicator = _ref => {
  let status = _ref.status,
    label = _ref.label,
    icon = _ref.icon;
  const color = STATUS_COLORS[status];
  return /*#__PURE__*/_jsxs("span", {
    className: "osd:inline-flex osd:items-center osd:gap-1",
    children: [icon ? /*#__PURE__*/_jsx("span", {
      className: "osd:flex osd:items-center",
      style: {
        color
      },
      children: icon
    }) : /*#__PURE__*/_jsx("span", {
      className: "osd:inline-flex osd:items-center osd:justify-center osd:w-4 osd:h-4 osd:text-xs osd:font-bold osd:leading-none",
      style: {
        color
      },
      role: "img",
      "aria-label": status,
      children: STATUS_ICONS[status]
    }), label && /*#__PURE__*/_jsx("span", {
      className: "osd:text-xs osd:text-body-secondary",
      children: label
    })]
  });
};