import { ImagePreview } from "@/components";
import {
  DealerInfo,
  OtherFees,
  OtherInfo,
  PackingSpec,
  ShippingInfo,
  TitleInfo,
  TotalAmount,
  VehicleInfo,
  WeightInfo,
} from "./section";

interface Step2PreviewProps {
  moduleList: any[];
}

export default function Step2Preview(props: Step2PreviewProps) {
  const { moduleList } = props;

  return (
    <ImagePreview>
      {moduleList.map((module) => {
        if (module.type === "title") {
          return <TitleInfo key={"title"} module={module} />;
        }

        if (module.type === "dealerInfo") {
          return <DealerInfo key={"dealerInfo"} module={module} />;
        }

        if (module.type === "shippingInfo") {
          return <ShippingInfo key={"shippingInfo"} module={module} />;
        }

        if (module.type === "weightInfo") {
          return <WeightInfo key={"weightInfo"} module={module} />;
        }

        if (module.type === "packingSpec") {
          return <PackingSpec key={"packingSpec"} module={module} />;
        }

        if (module.type === "vehicleInfo") {
          return <VehicleInfo key={"vehicleInfo"} module={module} />;
        }

        if (module.type === "otherFees") {
          return <OtherFees key={"otherFees"} module={module} />;
        }

        if (module.type === "totalAmount") {
          return <TotalAmount key={"totalAmount"} module={module} />;
        }

        if (module.type === "otherInfo") {
          return <OtherInfo key={"otherInfo"} module={module} />;
        }
      })}
    </ImagePreview>
  );
}
