/**
 * The platform's status vocabulary.
 *
 * There are 48 separate status→colour maps across the codebase, each deciding
 * independently what "pending" looks like. They disagree. The fix is not one
 * bigger map — domain statuses genuinely differ per feature — but one small set
 * of *tones* that every domain maps onto, so the colour decision is made six
 * times instead of forty-eight.
 *
 * `semantic.css` carries the CSS-variable form of these for stylesheet use.
 * This module is for the many places that need a Mantine `color` prop instead.
 */

export type StatusTone =
  | 'success'
  | 'warning'
  | 'danger'
  | 'info'
  | 'pending'
  | 'neutral';

/**
 * Tone → Mantine colour name.
 *
 * Deliberately the only place a tone becomes a colour. Changing the platform's
 * idea of "warning" is an edit here, not a sweep through 48 files.
 */
export const STATUS_TONE_COLOR: Record<StatusTone, string> = {
  success: 'green',
  warning: 'yellow',
  danger: 'red',
  info: 'blue',
  pending: 'orange',
  neutral: 'gray',
};

/**
 * Tone → CSS custom properties, for inline styles and stylesheets.
 *
 * Returns variable references rather than resolved colours so the values keep
 * following the active colour scheme.
 */
export function statusToneVars(tone: StatusTone): {
  color: string;
  background: string;
} {
  return {
    color: `var(--ema-status-${tone}-fg)`,
    background: `var(--ema-status-${tone}-bg)`,
  };
}
