"use strict";
var __accessCheck = (obj, member, msg) => {
  if (!member.has(obj))
    throw TypeError("Cannot " + msg);
};
var __privateAdd = (obj, member, value) => {
  if (member.has(obj))
    throw TypeError("Cannot add the same private member more than once");
  member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
};
var __privateMethod = (obj, member, method) => {
  __accessCheck(obj, member, "access private method");
  return method;
};
var _replacePathParams, replacePathParams_fn;
const common_js_net_http = require("./http.js");
const common_js_cache_storage = require("../cache/storage.js");
const proName = "plug";
const userId = common_js_cache_storage.get("userId");
const apiPath = {
  mineInvoiceOrderList: "/api/invoicerecharge/recharge-listpage/{userId}/{status}",
  //可以开具发票的订单
  mineInvoiceList: "/api/invoice-config/listpage/{userId}",
  //我的开票信息
  saveInvoiceInfo: "/api/invoice-config/save/{userId}",
  //保存开票信息
  updateInvoiceInfo: "/api/invoice-config/update/{invoiceId}",
  //修改开票信息
  deleteInvoiceInfo: "/api/invoice-config/remove/{ids}",
  //删除开票信息
  mineInvoiceRecordList: "/api/invoicerecharge/listpage/{userId}",
  //我的开票记录
  saveInvoiceRecord: "/api/invoicerecharge/save/{userId}",
  // 保存开票申请
  updateInvoiceRecord: "/api/invoicerecharge/update/{invoiceRechargeId}",
  //修改开票申请
  cancelInvoiceRecord: "/api/invoicerecharge/cancel/{invoiceRechargeId}",
  //取消开票申请
  dicByPId: "/api/data/listbyparentid/{pId}"
  //数据字典
};
class InvoiceApi {
  // 通用请求方法
  static requestHandler(endpoint, method, data = null, pathParams = {}) {
    const path = Object.keys(pathParams).length ? __privateMethod(this, _replacePathParams, replacePathParams_fn).call(this, endpoint, pathParams) : endpoint;
    return common_js_net_http.request(path, method, data, proName);
  }
  //获取可以开具发票的订单
  static doGetMineInvoiceOrderList(data, status) {
    return this.requestHandler(apiPath.mineInvoiceOrderList, "GET", data, {
      userId,
      status
    });
  }
  // 获取字典列表
  static doGetDicListByPId(id) {
    const path = apiPath.dicByPId.replace("{pId}", id);
    return common_js_net_http.request(path, "GET");
  }
  // 我的开票信息
  static doGetMineInvoiceList(data) {
    return this.requestHandler(apiPath.mineInvoiceList, "GET", data, {
      userId: common_js_cache_storage.get("userId")
    });
  }
  // 保存我的开票信息
  static doSaveMineInvoiceInfo(data) {
    return this.requestHandler(apiPath.saveInvoiceInfo, "POST", data, {
      userId: common_js_cache_storage.get("userId")
    });
  }
  // 编辑开票信息
  static doUpdateMineInvoiceInfo(id, data) {
    return this.requestHandler(apiPath.updateInvoiceInfo, "PUT", data, {
      invoiceId: id
    });
  }
  // 删除开票信息
  static doDelMineInvoiceInfo(id) {
    return this.requestHandler(apiPath.deleteInvoiceInfo, "DELETE", null, {
      ids: id
    });
  }
  // 开票申请列表（已修改，保持原有结构）
  static doGetInvoiceRecordList(data) {
    return this.requestHandler(apiPath.mineInvoiceRecordList, "GET", data, {
      userId: common_js_cache_storage.get("userId")
    });
  }
  // 取消开票申请
  static doCancelInvoiceRecord(id) {
    return this.requestHandler(apiPath.cancelInvoiceRecord, "PUT", null, {
      invoiceRechargeId: id
    });
  }
  // 提交开票申请
  static doSaveInvoiceRecord(data) {
    return this.requestHandler(apiPath.saveInvoiceRecord, "POST", data, {
      userId: common_js_cache_storage.get("userId")
    });
  }
  // 修改开票申请
  static doUpdateInvoiceRecord(id, data) {
    return this.requestHandler(apiPath.updateInvoiceRecord, "PUT", data, {
      invoiceRechargeId: id
    });
  }
}
_replacePathParams = new WeakSet();
replacePathParams_fn = function(path, params) {
  return Object.entries(params).reduce(
    (acc, [key, value]) => acc.replace(`{${key}}`, value),
    path
  );
};
// 通用路径参数替换方法
__privateAdd(InvoiceApi, _replacePathParams);
exports.InvoiceApi = InvoiceApi;
//# sourceMappingURL=../../../../.sourcemap/mp-baidu/common/js/net/InvoiceApi.js.map
