import request from '@/config/axios'

// 门墩儿-企业登录用户 VO
export interface EnterpriseUserBindVO {
  id: number // id
  enterpriseId: number // 企业id
  userId: string // 用户id
  status: number // 帐号状态（0正常 1停用 2 等待审核 3不通过）
  loginIp: string // 最后登录IP
  loginDate: Date // 最后登录时间
  userType: number // 用户类型（0普通企业用户 1 企业管理员）
}

// 门墩儿-企业登录用户 API
export const EnterpriseUserBindApi = {
  // 查询门墩儿-企业登录用户分页
  getEnterpriseUserBindPage: async (params: any) => {
    return await request.get({ url: `/menduner/system/enterprise-user-bind/page`, params })
  },

  // 查询门墩儿-企业登录用户详情
  getEnterpriseUserBind: async (id: number) => {
    return await request.get({ url: `/menduner/system/enterprise-user-bind/get?id=` + id })
  },

  // 新增门墩儿-企业登录用户
  createEnterpriseUserBind: async (data: EnterpriseUserBindVO) => {
    return await request.post({ url: `/menduner/system/enterprise-user-bind/create`, data })
  },

  // 修改门墩儿-企业登录用户
  updateEnterpriseUserBind: async (data: EnterpriseUserBindVO) => {
    return await request.put({ url: `/menduner/system/enterprise-user-bind/update`, data })
  },

  // 删除门墩儿-企业登录用户
  deleteEnterpriseUserBind: async (id: number) => {
    return await request.delete({ url: `/menduner/system/enterprise-user-bind/delete?id=` + id })
  },

  // 导出门墩儿-企业登录用户 Excel
  exportEnterpriseUserBind: async (params) => {
    return await request.download({ url: `/menduner/system/enterprise-user-bind/export-excel`, params })
  },

  // 获得企业登录用户
  getEnterpriseUserDetails: async (id: string) => {
    return await request.get({ url: `/menduner/system/enterprise-user-bind/get?id=${id}` })
  },

  // 获得企业用户账户信息
  getEnterpriseUserAccount: async (userId: string, dataId: string) => {
    return await request.get({ url: `/pay/currency/get?userId=${userId}&dataId=${dataId}` })
  },

  // 获得企业用户交易订单分页
  getEnterpriseUserTradeOrderPage: async (params) => {
    return await request.get({ url: `/menduner/system/trade/order/page`, params })
  },

  // 获得企业用户充值订单分页
  getEnterpriseUserRechargeOrderPage: async (params) => {
    return await request.get({ url: `/pay/currency-recharge/page`, params })
  },

  // 修改门墩儿-登录邮箱
  updateEnterpriseEmail: async (data) => {
    return await request.put({ url: `/menduner/system/enterprise-user-bind/update-email`, data })
  },

  // 更新企业登录用户
  updateEnterpriseInfo: async (data) => {
    return await request.put({ url: `/menduner/system/enterprise-user-bind/update`, data })
  },

  // 修改门墩儿-登录密码
  updateEnterprisePassword: async (data) => {
    return await request.put({ url: `/menduner/system/enterprise-user-bind/update-password`, data })
  },

  // 获得企业列表
  getEnterpriseList: async () => {
    return await request.get({ url: `/menduner/system/enterprise/list-all-simple` })
  },

  // 禁用账户
  disabledEnterpriseAccount: async (id: number) => {
    return await request.post({ url: `/menduner/system/enterprise-user-bind/disable?id=${id}` })
  },

  // 启用账户
  enableEnterpriseAccount: async (ids: array) => {
    return await request.post({ url: `/menduner/system/enterprise-user-bind/enable?ids=${ids}` })
  },
}