var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);

// src/solution/BookingTicket/utils/orderCustomer.ts
var orderCustomer_exports = {};
__export(orderCustomer_exports, {
  formatOrderCustomerPatch: () => formatOrderCustomerPatch
});
module.exports = __toCommonJS(orderCustomer_exports);
function resolveCustomerDisplayName(customer) {
  const c = customer;
  const displayName = c.display_name;
  if (typeof displayName === "string" && displayName)
    return displayName;
  const nickname = c.nickname;
  if (typeof nickname === "string" && nickname)
    return nickname;
  const firstName = c.first_name;
  const lastName = c.last_name;
  if (typeof firstName === "string" && firstName || typeof lastName === "string" && lastName) {
    return `${typeof firstName === "string" ? firstName : ""} ${typeof lastName === "string" ? lastName : ""}`.trim();
  }
  const customerName = c.customer_name;
  if (typeof customerName === "string" && customerName)
    return customerName;
  return customer.name ?? "";
}
function formatOrderCustomerPatch(customer) {
  var _a;
  const rawId = customer.id;
  const numericId = typeof rawId === "number" ? rawId : rawId !== void 0 && rawId !== null && rawId !== "" ? Number(rawId) : null;
  return {
    customer_id: Number.isFinite(numericId) ? numericId : null,
    customer_name: resolveCustomerDisplayName(customer),
    phone: customer.phone ?? "",
    email: customer.email ?? "",
    country_calling_code: ((_a = customer.country_calling_code) == null ? void 0 : _a.toString()) ?? ""
  };
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  formatOrderCustomerPatch
});
