import styles from "./quickActions.module.css";
import { vscode } from "../utils/vscode";

interface QuickAction {
  id: string;
  icon: string;
  title: string;
  description: string;
  action: () => void;
}

const QuickActions: React.FC = () => {
  const actions: QuickAction[] = [
    {
      id: "optimize-current",
      icon: "zap",
      title: "Optimize Current File",
      description: "Analyze and optimize all functions in the current file",
      action: () => {
        vscode.postMessage({ type: "optimizeCurrentFile" });
      },
    },
    {
      id: "optimize-diff",
      icon: "git-compare",
      title: "Optimize Changed Code",
      description: "Optimize functions in your git diff",
      action: () => {
        vscode.postMessage({ type: "optimizeCurrentDiff" });
      },
    },
  ];

  return (
    <div className={styles.quickActionsContainer}>
      <div className={styles.actionsGrid}>
        {actions.map((action) => (
          <button
            key={action.id}
            className={styles.actionCard}
            onClick={action.action}
          >
            <div className={styles.actionIcon}>
              <span className={`codicon codicon-${action.icon}`}></span>
            </div>
            <div className={styles.actionContent}>
              <span className={styles.actionTitle}>{action.title}</span>
              <span className={styles.actionDescription}>
                {action.description}
              </span>
            </div>
          </button>
        ))}
      </div>
    </div>
  );
};

export default QuickActions;
