"use client";

import React from "react";
import { Check, ArrowRight } from "lucide-react";

interface StepProgressProps {
  currentStep: 1 | 2 | 3;
  onStepChange: (step: 1 | 2 | 3) => void;
}

const steps = [
  { id: 1, title: "연결 선택", description: "FROM/TO 연결 설정" },
  { id: 2, title: "테이블 선택", description: "소스/타겟 테이블 선택" },
  { id: 3, title: "필드 매핑", description: "시각적 필드 매핑" },
];

export const StepProgress: React.FC<StepProgressProps> = ({
  currentStep,
  onStepChange,
}) => {
  return (
    <div className="bg-white border-b border-border px-6 py-4">
      <div className="flex items-center justify-between">
        {steps.map((step, index) => (
          <React.Fragment key={step.id}>
            <div
              className={`flex items-center gap-3 cursor-pointer transition-all duration-200 ${
                step.id <= currentStep ? "opacity-100" : "opacity-50"
              }`}
              onClick={() => step.id <= currentStep && onStepChange(step.id as 1 | 2 | 3)}
            >
              <div
                className={`w-8 h-8 rounded-full flex items-center justify-center text-sm font-medium transition-all duration-200 ${
                  step.id < currentStep
                    ? "bg-emerald-500 text-white"
                    : step.id === currentStep
                    ? "bg-amber-500 text-white"
                    : "bg-muted/80 text-muted-foreground"
                }`}
              >
                {step.id < currentStep ? (
                  <Check className="w-4 h-4" />
                ) : (
                  step.id
                )}
              </div>
              
              <div>
                <h3 className={`text-sm font-medium ${
                  step.id <= currentStep ? "text-foreground" : "text-muted-foreground"
                }`}>
                  {step.title}
                </h3>
                <p className={`text-xs ${
                  step.id <= currentStep ? "text-muted-foreground" : "text-muted-foreground/70"
                }`}>
                  {step.description}
                </p>
              </div>
            </div>
            
            {index < steps.length - 1 && (
              <ArrowRight className="w-4 h-4 text-muted-foreground/70 mx-4" />
            )}
          </React.Fragment>
        ))}
      </div>
    </div>
  );
};