"use client";
import { jsx, jsxs } from "react/jsx-runtime";
import { match } from "ts-pattern";
import { Page, PageBody } from "@open-mercato/ui/backend/Page";
import { FormHeader } from "@open-mercato/ui/backend/forms";
import { useT } from "@open-mercato/shared/lib/i18n/context";
import { WizardNav } from "../../../lib/shipment-wizard/components/WizardNav.js";
import { ProviderStep } from "../../../lib/shipment-wizard/components/ProviderStep.js";
import { ConfigureStep } from "../../../lib/shipment-wizard/components/ConfigureStep.js";
import { ConfirmStep } from "../../../lib/shipment-wizard/components/ConfirmStep.js";
import { useShipmentWizard } from "../../../lib/shipment-wizard/hooks/useShipmentWizard.js";
const CreateCarrierShipmentPage = () => {
  const t = useT();
  const wizard = useShipmentWizard();
  return /* @__PURE__ */ jsx(Page, { children: /* @__PURE__ */ jsxs(PageBody, { children: [
    /* @__PURE__ */ jsx(
      FormHeader,
      {
        backHref: wizard.backHref,
        title: t("shipping_carriers.create.title", "Create carrier shipment")
      }
    ),
    /* @__PURE__ */ jsx(WizardNav, { step: wizard.step, onNavigate: wizard.goToStep }),
    match(wizard.step).with("provider", () => /* @__PURE__ */ jsx(
      ProviderStep,
      {
        isLoading: wizard.isLoadingProviders,
        error: wizard.providerError,
        providers: wizard.providers,
        onSelect: wizard.handleProviderSelect
      }
    )).with("configure", () => /* @__PURE__ */ jsx(
      ConfigureStep,
      {
        origin: wizard.origin,
        destination: wizard.destination,
        packages: wizard.packages,
        labelFormat: wizard.labelFormat,
        senderContact: wizard.senderContact,
        receiverContact: wizard.receiverContact,
        targetPoint: wizard.targetPoint,
        c2cSendingMethod: wizard.c2cSendingMethod,
        isFetchingRates: wizard.isFetchingRates,
        canProceed: wizard.canProceedFromConfigure,
        senderContactErrors: wizard.senderContactErrors,
        receiverContactErrors: wizard.receiverContactErrors,
        dropOffPointQuery: wizard.dropOffPointQuery,
        dropOffPoints: wizard.dropOffPoints,
        isFetchingDropOffPoints: wizard.isFetchingDropOffPoints,
        dropOffPointsError: wizard.dropOffPointsError,
        onOriginChange: wizard.setOrigin,
        onDestinationChange: wizard.setDestination,
        onPackagesChange: wizard.setPackages,
        onLabelFormatChange: wizard.setLabelFormat,
        onSenderContactChange: wizard.setSenderContact,
        onReceiverContactChange: wizard.setReceiverContact,
        onTargetPointChange: wizard.setTargetPoint,
        onC2cSendingMethodChange: wizard.setC2cSendingMethod,
        onSearchDropOffPoints: wizard.searchDropOffPoints,
        onBack: () => wizard.goToStep("provider"),
        onNext: wizard.handleConfigureNext
      }
    )).with("confirm", () => /* @__PURE__ */ jsx(
      ConfirmStep,
      {
        rates: wizard.rates,
        ratesError: wizard.ratesError,
        selectedRate: wizard.selectedRate,
        selectedProvider: wizard.selectedProvider ?? "",
        origin: wizard.origin,
        destination: wizard.destination,
        packages: wizard.packages,
        labelFormat: wizard.labelFormat,
        senderContact: wizard.senderContact,
        receiverContact: wizard.receiverContact,
        targetPoint: wizard.targetPoint,
        c2cSendingMethod: wizard.c2cSendingMethod,
        isSubmitting: wizard.isSubmitting,
        onRateSelect: wizard.setSelectedRate,
        onBack: () => wizard.goToStep("configure"),
        onSubmit: wizard.handleSubmit
      }
    )).exhaustive()
  ] }) });
};
var page_default = CreateCarrierShipmentPage;
export {
  page_default as default
};
//# sourceMappingURL=page.js.map
