import {
  AncillaryStepEnum,
  useAddAncillaryStore,
} from "@/stores/my-stay/add-ancillary-flow"

import ConfirmationStep from "./ConfirmationStep"
import DeliveryMethodStep from "./DeliveryDetailsStep"
import SelectQuantityStep from "./SelectQuantityStep"

import type { StepsProps } from "@/types/components/myPages/myStay/ancillaries"

export default function Steps({ user, savedCreditCards, error }: StepsProps) {
  const currentStep = useAddAncillaryStore((state) => state.currentStep)

  switch (currentStep) {
    case AncillaryStepEnum.selectQuantity:
      return <SelectQuantityStep user={user} />
    case AncillaryStepEnum.selectDelivery:
      return <DeliveryMethodStep />
    case AncillaryStepEnum.confirmation:
      return (
        <ConfirmationStep
          savedCreditCards={savedCreditCards}
          user={user}
          error={error}
        />
      )
  }
}
