import { A as VoucherState, C as ProductKind, D as UUID_RE, E as ShipmentStatus, M as assertUuid, N as normalizeEmail, O as VOUCHER_STATES, P as ownerKeyOf, S as OrderLine, T as Shipment, _ as FulfillmentOverall, a as fulfillmentDbSchema, b as LineFulfillmentOutcome, c as voucher, d as Address, f as BuyerRef, g as FulfillmentNotification, h as FulfillmentKind, i as carrierWebhookEvent, j as assertPositiveInt, k as Voucher, l as AccessGrant, m as CarrierWebhookResult, n as FulfillmentSchema, o as fulfillmentSchema, p as CarrierTrackResult, r as accessGrant, s as shipment, t as FulfillmentDbSchema, u as Actor, v as FulfillmentResult, w as SHIPMENT_STATUSES, x as Order, y as Label } from "./schema-CIDxLCgB.js";
import { n as grantDigitalAccess, t as issueDownloadToken } from "./digital-DDubOKOg.js";
import { a as StorageAdapter, i as FulfillmentPorts, n as CarrierAdapter, r as CarrierCapabilities, t as BuyLabelArgs } from "./seams-CsBH_YwI.js";
import { a as decideRedemption, i as RedeemEvent, n as issueVoucher, r as RedeemDecision, t as redeemVoucher } from "./voucher-DHtPXbJQ.js";
import { i as createShipment, n as handleCarrierWebhook, r as buyShippingLabel, t as trackShipment } from "./physical-CYK3BJBT.js";
import { Order as Order$1 } from "@platform-modules/commerce-orders";
import { Querier } from "@platform-modules/db";
//#region src/fulfill.d.ts
declare function fulfillOrder(ports: FulfillmentPorts, order: Order$1): Promise<FulfillmentResult>;
//#endregion
//#region src/migrate.d.ts
declare class FulfillmentMigrateError extends Error {
  readonly detail: string;
  readonly name = "FulfillmentMigrateError";
  readonly code: "FULFILLMENT_MIGRATE";
  constructor(detail: string);
}
declare function isFulfillmentMigrateError(e: unknown): e is FulfillmentMigrateError;
declare function pushSchema(db: Querier<FulfillmentSchema>): Promise<void>;
//#endregion
//#region src/errors.d.ts
declare class FulfillmentValidationError extends Error {
  readonly field: string;
  readonly name = "FulfillmentValidationError";
  readonly code: "FULFILLMENT_VALIDATION";
  constructor(field: string);
}
declare class VoucherAlreadyRedeemedError extends Error {
  readonly voucherId: string;
  readonly name = "VoucherAlreadyRedeemedError";
  readonly code: "VOUCHER_ALREADY_REDEEMED";
  readonly httpStatus: 409;
  constructor(voucherId: string);
}
declare class VoucherExpiredError extends Error {
  readonly voucherId: string;
  readonly name = "VoucherExpiredError";
  readonly code: "VOUCHER_EXPIRED";
  readonly httpStatus: 422;
  constructor(voucherId: string);
}
declare class VoucherWrongVendorError extends Error {
  readonly context: {
    voucherId: string;
    scanningVendorId: string;
  };
  readonly name = "VoucherWrongVendorError";
  readonly code: "VOUCHER_WRONG_VENDOR";
  readonly httpStatus: 403;
  constructor(context: {
    voucherId: string;
    scanningVendorId: string;
  });
}
declare class LabelPurchaseError extends Error {
  readonly shipmentId: string;
  readonly detail: string;
  readonly name = "LabelPurchaseError";
  readonly code: "LABEL_PURCHASE";
  readonly httpStatus: 502;
  constructor(shipmentId: string, detail: string);
}
declare class UnfulfillableLineError extends Error {
  readonly context: {
    orderId: string;
    lineId: string;
    kind: string;
  };
  readonly name = "UnfulfillableLineError";
  readonly code: "UNFULFILLABLE_LINE";
  readonly httpStatus: 422;
  constructor(context: {
    orderId: string;
    lineId: string;
    kind: string;
  });
}
declare class DownloadNotFoundError extends Error {
  readonly grantId: string;
  readonly name = "DownloadNotFoundError";
  readonly code: "DOWNLOAD_NOT_FOUND";
  readonly httpStatus: 404;
  constructor(grantId: string);
}
declare function isFulfillmentValidationError(e: unknown): e is FulfillmentValidationError;
declare function isVoucherAlreadyRedeemedError(e: unknown): e is VoucherAlreadyRedeemedError;
declare function isVoucherExpiredError(e: unknown): e is VoucherExpiredError;
declare function isVoucherWrongVendorError(e: unknown): e is VoucherWrongVendorError;
declare function isLabelPurchaseError(e: unknown): e is LabelPurchaseError;
declare function isUnfulfillableLineError(e: unknown): e is UnfulfillableLineError;
declare function isDownloadNotFoundError(e: unknown): e is DownloadNotFoundError;
//#endregion
export { type AccessGrant, type Actor, type Address, type BuyLabelArgs, type BuyerRef, type CarrierAdapter, type CarrierCapabilities, type CarrierTrackResult, type CarrierWebhookResult, DownloadNotFoundError, type FulfillmentDbSchema, type FulfillmentKind, FulfillmentMigrateError, type FulfillmentNotification, type FulfillmentOverall, type FulfillmentPorts, type FulfillmentResult, type FulfillmentSchema, FulfillmentValidationError, type Label, LabelPurchaseError, type LineFulfillmentOutcome, type Order, type OrderLine, type ProductKind, type RedeemDecision, type RedeemEvent, SHIPMENT_STATUSES, type Shipment, type ShipmentStatus, type StorageAdapter, UUID_RE, UnfulfillableLineError, VOUCHER_STATES, type Voucher, VoucherAlreadyRedeemedError, VoucherExpiredError, type VoucherState, VoucherWrongVendorError, accessGrant, assertPositiveInt, assertUuid, buyShippingLabel, carrierWebhookEvent, createShipment, decideRedemption, fulfillOrder, fulfillmentDbSchema, fulfillmentSchema, grantDigitalAccess, handleCarrierWebhook, isDownloadNotFoundError, isFulfillmentMigrateError, isFulfillmentValidationError, isLabelPurchaseError, isUnfulfillableLineError, isVoucherAlreadyRedeemedError, isVoucherExpiredError, isVoucherWrongVendorError, issueDownloadToken, issueVoucher, normalizeEmail, ownerKeyOf, pushSchema, redeemVoucher, shipment, trackShipment, voucher };