import { A as u, I as i } from "./index.vue_vue_type_script_setup_true_lang-BMVa5UfU.js";
var a = /* @__PURE__ */ ((e) => (e.AUTO = "auto", e.MANUAL = "manual", e))(a || {}), m = /* @__PURE__ */ ((e) => (e[e.Normal = 0] = "Normal", e[e.Rules = 1] = "Rules", e))(m || {});
class s {
  static fromCatalog(r, n) {
    const t = n ? u.F_ORDER_FROM.enum.ALL : u.F_ORDER_FROM.enum.NONE;
    return {
      ...i(r),
      taxSetting: this.transformTax(r.inclusiveTaxes),
      orderFrom: r.defaultOrderFrom || t,
      markupOptions: r.markupOptions || null,
      usePriceTiers: r.usePriceTiers || null,
      priceTierRules: r.priceTierRules || null
    };
  }
  static fromMainCatalog(r) {
    return {
      _id: "",
      name: "Main",
      taxSetting: s.transformTax(r == null ? void 0 : r.inclusiveTaxes),
      orderFrom: u.F_ORDER_FROM.enum.ALL,
      markupOptions: null,
      usePriceTiers: null,
      priceTierRules: null
    };
  }
  static toCatalog(r) {
    return {
      _id: r._id,
      name: r.name,
      inclusiveTaxes: r.taxSetting.mode === "auto" ? null : i(r.taxSetting.inclusive),
      markupOptions: r.markupOptions,
      defaultOrderFrom: r.orderFrom,
      usePriceTiers: r.usePriceTiers,
      priceTierRules: r.priceTierRules
    };
  }
  static initCatalogSetting() {
    return {
      _id: "",
      name: "",
      orderFrom: u.F_ORDER_FROM.enum.ALL,
      taxSetting: this.autoTax(),
      markupOptions: null,
      usePriceTiers: null,
      priceTierRules: null
    };
  }
  static transformTax(r) {
    return r ? {
      mode: "manual",
      inclusive: i(r)
    } : {
      mode: "auto"
      /* AUTO */
    };
  }
  static autoTax() {
    return {
      mode: "auto"
      /* AUTO */
    };
  }
  static manualTax(r) {
    return { mode: "manual", inclusive: i(r) };
  }
}
export {
  s as C,
  m as L,
  a
};
