export interface MessageMode {
  id: string;
  name: string;
  description: string;
  prefix?: string;
  icon: string;
}

export const MESSAGE_MODES: MessageMode[] = [
  {
    id: "chat",
    name: "Chat",
    description: "Normal conversation mode",
    icon: "💬",
  },
  {
    id: "architect",
    name: "Architect",
    description: "High-level design and architecture planning",
    prefix: "[Architect Mode] ",
    icon: "🏗️",
  },
  {
    id: "code",
    name: "Code",
    description: "Focused on writing and editing code",
    prefix: "[Code Mode] ",
    icon: "💻",
  },
  {
    id: "debug",
    name: "Debug",
    description: "Help with debugging and troubleshooting",
    prefix: "[Debug Mode] ",
    icon: "🐛",
  },
  {
    id: "ask",
    name: "Ask",
    description: "Technical questions and explanations",
    prefix: "[Ask Mode] ",
    icon: "❓",
  },
  {
    id: "review",
    name: "Review",
    description: "Code review and feedback",
    prefix: "[Review Mode] ",
    icon: "👀",
  },
];

export function getMessageMode(id: string): MessageMode | undefined {
  return MESSAGE_MODES.find((mode) => mode.id === id);
}

export function formatMessageWithMode(message: string, modeId: string): string {
  const mode = getMessageMode(modeId);
  if (!mode || !mode.prefix) {
    return message;
  }

  // Don't double-prefix if the message already starts with the prefix
  if (message.startsWith(mode.prefix)) {
    return message;
  }

  return mode.prefix + message;
}
