import { defineStore as tt } from "pinia";
import "vue";
import { M as st, s, Z as e, a$ as d } from "./start-CE9SawgU.js";
import "vue-i18n";
import "./header-Bn1EKnBE.js";
import { p as et } from "./PIM-B4XbTS97.js";
const g = st, r = `${g}RMA.`, n = `${r}Settings.`, a = {
  /** getUserRestrictionSettings */
  async getUserRestrictionSettings() {
    return s.post(`${n}getUserRestrictionSettings`);
  },
  /** getBusinessPositionReturnDataGroupAttributes */
  async getBusinessPositionReturnDataGroupAttributes() {
    return s.post(
      `${n}getBusinessPositionReturnDataGroupAttributes`
    );
  },
  /** getQuantityValidationSettingsOptions */
  async getQuantityValidationSettingsOptions() {
    return s.post(
      `${n}getQuantityValidationSettingsOptions`
    );
  },
  /** listDocumentTypeFilters */
  async listDocumentTypeFilters() {
    return s.post(`${n}listDocumentTypeFilters`);
  },
  /** listDocumentTypes */
  async listDocumentTypes() {
    return s.post(`${n}listDocumentTypes`);
  },
  /** listReturnReasons */
  async listReturnReasons() {
    return s.post(`${n}listReturnReasons`);
  },
  /** listConditions */
  async listConditions() {
    return s.post(`${n}listConditions`);
  }
}, it = `${g}Material.`, nt = `${it}Materials.`, at = {
  /** List Materials */
  async getList(t) {
    return s.post(`${nt}getList`, t);
  }
}, ot = `${r}RmaPositions.`, rt = {
  /** getPositionTypes */
  async getPositionTypes() {
    return s.post(`${ot}getPositionTypes`);
  }
}, u = `${r}Rules.`, ut = {
  /** getList */
  async getList(t) {
    return s.post(`${u}getList`, t);
  },
  /** create */
  async create(t) {
    return s.post(`${u}create`, { rule: t });
  },
  /** save */
  async save(t) {
    return s.post(`${u}save`, { rule: t });
  },
  /** load */
  async load(t) {
    return s.post(`${u}load`, { rule: { id: t } });
  },
  /** delete */
  async delete(t) {
    return s.post(`${u}delete`, {
      rule: { id: t }
    });
  }
}, o = `${r}AdvancedRules.`, pt = {
  /** getList */
  async getList(t) {
    return s.post(`${o}getList`, t);
  },
  /** create */
  async create(t) {
    return s.post(`${o}create`, { advancedRule: t });
  },
  /** save */
  async save(t) {
    return s.post(`${o}save`, { advancedRule: t });
  },
  /** load */
  async load(t) {
    return s.post(`${o}load`, {
      advancedRule: { id: t }
    });
  },
  /** delete */
  async delete(t) {
    return s.post(`${o}delete`, {
      advancedRule: { id: t }
    });
  },
  /** getMaterialFields */
  async getMaterialFields() {
    return s.post(`${o}getMaterialFields`);
  },
  /** getBusinessDocumentPositionFields */
  async getBusinessDocumentPositionFields() {
    return s.post(
      `${o}getBusinessDocumentPositionFields`
    );
  }
};
var c = /* @__PURE__ */ ((t) => (t.DRAFT = "draft", t.WORKFLOW_VALIDATION = "workflow_validation", t.COMPLETED = "completed", t))(c || {}), l = /* @__PURE__ */ ((t) => (t.DRAFT = "draft", t.COMPLETED = "completed", t.CANCELED = "canceled", t))(l || {});
l.DRAFT + "", l.CANCELED + "", l.COMPLETED + "";
c.DRAFT + "", c.WORKFLOW_VALIDATION + "", c.COMPLETED + "";
const p = `${r}FollowUps.`, dt = {
  /** getList */
  async getList(t) {
    return s.post(`${p}getList`, t);
  },
  /** create */
  async create(t) {
    return s.post(`${p}create`, { followUp: t });
  },
  /** save */
  async save(t) {
    return s.post(`${p}save`, { followUp: t });
  },
  /** load */
  async load(t) {
    return s.post(`${p}load`, {
      followUp: { id: t }
    });
  },
  /** delete */
  async delete(t) {
    return s.post(`${p}delete`, {
      followUp: { id: t }
    });
  }
}, ct = `${r}Addresses.`, lt = {
  /** getAddressTypes */
  async getAddressTypes() {
    return s.post(`${ct}getAddressTypes`);
  }
}, mt = tt(
  "RMA-returns-dictionary",
  () => {
    const t = {};
    async function y(i) {
      return t[i] || (t[i] = et.getProductBySku(i)), t[i];
    }
    const {
      data: L,
      isLoading: A,
      api: $
    } = e({
      apiFn: a.listDocumentTypes
    }), {
      data: D,
      isLoading: m,
      api: R
    } = e({
      apiFn: a.getQuantityValidationSettingsOptions
    }), {
      data: F,
      isLoading: P,
      api: E
    } = e({
      apiFn: a.listConditions
    }), {
      data: O,
      isLoading: T,
      api: S
    } = e({
      apiFn: a.listReturnReasons
    }), {
      data: B,
      isLoading: v,
      api: M
    } = e({
      apiFn: a.getUserRestrictionSettings
    }), {
      data: I,
      isLoading: _,
      api: f
    } = e({
      apiFn: async () => {
        const i = await a.listDocumentTypeFilters();
        return {
          ...i,
          data: Array.isArray(i.data) ? i.data : Object.values(i.data)
        };
      }
    }), {
      data: U,
      isLoading: C,
      api: w
    } = e({
      apiFn: rt.getPositionTypes
    }), {
      data: b,
      isLoading: V,
      api: G
    } = e({
      apiFn: () => at.getList({
        limit: d,
        filter: [
          { property: "isStklst", operator: "=", value: !1, active: !0 }
        ]
      })
    }), {
      data: Q,
      isLoading: W,
      api: k
    } = e({
      apiFn: () => ut.getList({ limit: d })
    }), {
      data: x,
      isLoading: K,
      api: N
    } = e({
      apiFn: () => pt.getList({ limit: d })
    }), {
      data: j,
      isLoading: q,
      api: X
    } = e({
      apiFn: () => dt.getList({ limit: d })
    }), {
      data: Z,
      isLoading: h,
      api: z
    } = e({
      apiFn: lt.getAddressTypes
    }), {
      data: H,
      isLoading: J,
      api: Y
    } = e({
      apiFn: a.getBusinessPositionReturnDataGroupAttributes
    });
    return {
      /** Document types */
      documentTypes: L,
      isDocumentTypesLoading: A,
      ensureDocumentTypes: $,
      /** Quantity validation settings options */
      quantityValidationSettingsOptions: D,
      isQuantityValidationSettingsOptionsLoading: m,
      ensureQuantityValidationSettingsOptions: R,
      /** Conditions */
      conditions: F,
      isConditionsLoading: P,
      ensureConditions: E,
      /** Return reasons */
      returnReasons: O,
      isReturnReasonsLoading: T,
      ensureReturnReasons: S,
      /** User restriction settings */
      userRestrictionSettings: B,
      isUserRestrictionSettingsLoading: v,
      ensureUserRestrictionSettings: M,
      /** Document type filters */
      documentTypeFilters: I,
      isDocumentTypeFiltersLoading: _,
      ensureDocumentTypeFilters: f,
      /** Position types */
      positionTypes: U,
      isPositionTypesLoading: C,
      ensurePositionTypes: w,
      /** Materials */
      materials: b,
      isMaterialsLoading: V,
      ensureMaterials: G,
      /** Rules */
      rules: Q,
      isRulesLoading: W,
      ensureRules: k,
      /** AdvancedRules */
      advancedRules: x,
      isAdvancedRulesLoading: K,
      ensureAdvancedRules: N,
      /** FollowUps */
      followUps: j,
      isFollowUpsLoading: q,
      ensureFollowUps: X,
      /** Address types */
      addressTypes: Z,
      isAddressTypesLoading: h,
      ensureAddressTypes: z,
      /** Business Position Return Data Group Attributes */
      businessPositionReturnDataGroupAttributes: H,
      isBusinessPositionReturnDataGroupAttributesLoading: J,
      ensureBusinessPositionReturnDataGroupAttributes: Y,
      getProductBySku: y
    };
  }
);
export {
  mt as u
};
