export {
  assertWithdrawChannelAllowedForAmount,
  isWorkerPasswordStrong,
  normalizeAdminFinanceReviewStatus,
  normalizeAmountFen,
  normalizeEnabledStatus,
  normalizeFinanceRequestStatus,
  normalizeFinanceRequestType,
  normalizeMatchType,
  normalizeOptionalId,
  normalizePassword,
  normalizeProblemResolutionAction,
  normalizeProofFiles,
  normalizeReviewStatus,
  normalizeSlugKey,
  normalizeUsername,
  normalizeWalletLedgerType,
  normalizeWithdrawChannel,
  normalizeWorkerFreezeReason,
  throwGrabWorkOrderFailure,
  validateWorkerPassword,
  validateWorkerUsername,
} from './worker-platform-normalizers.js'
export {
  normalizeRequirementFields,
  normalizeRequirementFieldsFromPayload,
  normalizeRequirementFieldsText,
  resolveRequirementFields,
  type RequirementField,
} from './work-order-requirement-fields.js'
export {
  isWorkOrderSharingFilled,
  resolveSkuNameQuantity,
  resolveWorkOrderRulePricing,
  resolveWorkOrderSharingEnabled,
} from './work-order-pricing.js'

export {
  ensureWorkerAuthConfigured,
  hashWorkerPassword,
  safeCompare,
  signWorkerPayload,
  verifyWorkerPassword,
} from './worker-auth-utils.js'
export {
  normalizeBoolean,
  normalizeInteger,
  normalizePositiveInteger,
  normalizeSessionVersion,
} from './worker-normalizers.js'
export {
  normalizeStringArray,
  normalizeSubmittedFields,
  normalizeStatuses,
  normalizeUploadedFiles,
} from './worker-input-normalizers.js'
export {
  canWorkerAutoAcceptWholeOrder,
  resolveFreezeDepositAmount,
  resolveVisibleDelaySeconds,
  resolveWorkerPermissions,
} from './worker-permission-utils.js'

export {
  createWorkerSession,
  DEFAULT_CATEGORY_KEY,
  DEFAULT_DEPOSIT_THRESHOLD_AMOUNT,
  DEFAULT_LEVEL_KEY,
  DEFAULT_LEVEL_NAME,
  INVITE_CODE_LENGTH,
  INVITE_CODE_RETRY_LIMIT,
  mapFinanceRequest,
  mapWallet,
  mapWalletLedger,
  mapWorkerAfterSalesCase,
  mapWorkerCancelRequest,
  mapWorkerLevel,
  mapWorkerOrderFeedback,
  mapWorkerUser,
  WORKER_CANCEL_LIMIT_PER_WINDOW,
  WORKER_CANCEL_LIMIT_WINDOW_MS,
  normalizeWorkerType,
} from './worker-finance-mappers.js'

export {
  mapCollectLookupOrder,
  mapWorkCategory,
  mapWorkOrderAdmin,
  mapWorkOrderForWorker,
  mapWorkOrderMaterial,
  mapWorkOrderPublic,
  mapWorkOrderShare,
  mapWorkOrderSharingWorkers,
  resolveWorkOrderOperationalStatus,
  resolveWorkerShareProductName,
  resolveWorkerShareStatus,
} from './work-order-display-mappers.js'

export {
  type KuaishouWorkProductMatchContext,
  mapWorkProductRule,
  matchesOptionalText,
  normalizeWorkProductRuleMatch,
  type WorkProductRuleMatchDecision,
  resolveKuaishouWorkProductMatchContext,
  resolveMatchingProductRule,
  resolveMatchingProductRuleDecision,
} from './work-product-match-mappers.js'

export {
  mapAcceptanceForResponse,
  resolveCollectSubmittedFieldValues,
} from './work-order-material-mappers.js'

export function isIgnorableWorkerAuthError(error: unknown) {
  return IGNORABLE_WORKER_AUTH_ERROR_CODES.has(
    String((error as { errorCode?: string })?.errorCode || '').trim(),
  )
}

export const IGNORABLE_WORKER_AUTH_ERROR_CODES = new Set([
  'worker_auth_required',
  'worker_auth_invalid',
  'worker_auth_expired',
  'worker_auth_user_invalid',
  'worker_auth_stale',
  'worker_auth_device_revoked',
])

export { mapWorkOrderEvents, type WorkOrderEventView } from './work-order-event-mappers.js'
