import type { TransactionStatus } from "../types/transaction";

interface TransactionStatusBadgeProps {
  status: TransactionStatus;
}

export function TransactionStatusBadge({
  status,
}: TransactionStatusBadgeProps) {
  const statusConfig: Record<
    TransactionStatus,
    { label: string; color: string }
  > = {
    success: {
      label: "Success",
      color: "bg-success-light text-success",
    },
    failed: {
      label: "Failed",
      color: "bg-danger-light text-danger",
    },

    pending: {
      label: "Pending",
      color: "bg-yellow-100 text-yellow-700",
    },

    cancelled: {
      label: "Cancelled",
      color: "bg-red-100 text-red-700",
    },
  };

  const config = statusConfig[status];

  return (
    <span
      className={`inline-flex items-center rounded-full px-3 py-1 text-xs font-medium ${config?.color}`}
    >
      {config?.label}
    </span>
  );
}
