/**
 * EDR design-system tokens used across the notification surfaces, with safe
 * fallbacks so the shared components still render outside the freight apps.
 */
export const edr = {
  text: "var(--mantine-color-edr-text-6, var(--mantine-color-text))",
  muted: "var(--mantine-color-edr-muted-6, var(--mantine-color-dimmed))",
  border: "var(--mantine-color-edr-border-6, var(--mantine-color-default-border))",
  card: "var(--mantine-color-edr-card-6, var(--mantine-color-body))",
  amber: "var(--mantine-color-edr-accent-6, #F2A516)",
  amberSoft: "var(--mantine-color-edr-amber-soft-6, #FDF3E0)",
  amberText: "var(--mantine-color-edr-amber-text-6, #9A5B00)",
} as const;

/** True when a notification's priority string denotes HIGH urgency. */
export const isHighPriority = (priority?: string | null): boolean =>
  typeof priority === "string" && priority.toUpperCase() === "HIGH";

/** Small amber "High" pill for urgent notifications. */
export function PriorityTag() {
  return (
    <span
      style={{
        display: "inline-flex",
        alignItems: "center",
        fontSize: 10,
        fontWeight: 700,
        letterSpacing: 0.4,
        lineHeight: 1.4,
        textTransform: "uppercase",
        padding: "1px 6px",
        borderRadius: 999,
        color: edr.amberText,
        background: edr.amberSoft,
        whiteSpace: "nowrap",
      }}
    >
      High
    </span>
  );
}
