import type { TguPlanStatus } from "../../model/tguTypes";
import type { TimelineStatusStyle } from "../../model/timelineTypes";

export const STATUS_STYLES: TimelineStatusStyle[] = [
  { status: "ACCEPTED", label: "ACCEPTED", color: "#2f9e44", className: "status-accepted" },
  { status: "REJECTED", label: "REJECTED", color: "#d64545", className: "status-rejected" },
  { status: "WAITING_DECISION", label: "WAITING_DECISION", color: "#f0ad2e", className: "status-waiting" },
  { status: "PLANNED", label: "PLANNED", color: "#8d99a6", className: "status-planned" },
  { status: "ISSUING", label: "ISSUING", color: "#2f80ed", className: "status-issuing" },
  { status: "EXPIRED", label: "EXPIRED", color: "#495057", className: "status-expired" },
  { status: "SUPERSEDED", label: "SUPERSEDED", color: "#c7ced6", className: "status-superseded" },
  { status: "START_AMBIGUOUS", label: "START_AMBIGUOUS", color: "#b42318", className: "status-ambiguous" }
];

const STATUS_BY_NAME = new Map(STATUS_STYLES.map((style) => [style.status, style]));

export function statusStyle(status: TguPlanStatus): TimelineStatusStyle {
  return (
    STATUS_BY_NAME.get(status) ?? {
      status,
      label: status || "UNKNOWN",
      color: "#79828d",
      className: "status-unknown"
    }
  );
}
