"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-gray-200 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-green-500 text-white"
                    : step.id === currentStep
                    ? "bg-orange-500 text-white"
                    : "bg-gray-200 text-gray-600"
                }`}
              >
                {step.id < currentStep ? (
                  <Check className="w-4 h-4" />
                ) : (
                  step.id
                )}
              </div>
              
              <div>
                <h3 className={`text-sm font-medium ${
                  step.id <= currentStep ? "text-gray-900" : "text-gray-500"
                }`}>
                  {step.title}
                </h3>
                <p className={`text-xs ${
                  step.id <= currentStep ? "text-gray-600" : "text-gray-400"
                }`}>
                  {step.description}
                </p>
              </div>
            </div>
            
            {index < steps.length - 1 && (
              <ArrowRight className="w-4 h-4 text-gray-400 mx-4" />
            )}
          </React.Fragment>
        ))}
      </div>
    </div>
  );
};