"use client";

import { UploadProvider, useUploadContext } from "./_context/upload-context";

// Pastikan path import ini benar mengarah ke file masing-masing
import StepUpload from "./_components/step-1-upload";
import StepPdfViewer from "./_components/step-2-pdf-viewer";
import StepTablePicker from "./_components/step-3-table-picker";
import StepValidate from "./_components/step-4-validate";
import StepSuccess from "./_components/step-5-success";

// Komponen Wizard Internal
function UploadWizard() {
  const { state } = useUploadContext();

  switch (state.step) {
    case "UPLOAD":
      return <StepUpload />;
    case "PDF_VIEWER":
      return <StepPdfViewer />;
    case "TABLE_PICKER":
      return <StepTablePicker />;
    case "VALIDATE":
      return <StepValidate />;
    case "SUCCESS":
      return <StepSuccess />;
    default:
      return <StepUpload />;
  }
}

// Komponen Utama yang Di-export Default
export default function UploadPageClient() {
  return (
    <UploadProvider>
       <div className="bg-white h-[calc(100vh-170px)] rounded-lg shadow-sm p-4 overflow-auto">
        <UploadWizard />
      </div>
    </UploadProvider>
  );
}