import request from '@/utils/request'

// 查询TmMember列表
export function listTmMember(query) {
  return request({
    url: '/api/v1/tm-member',
    method: 'get',
    params: query
  })
}

// 查询TmMember详细
export function getTmMember(id) {
  return request({
    url: '/api/v1/tm-member/' + id,
    method: 'get'
  })
}

// 新增TmMember
export function addTmMember(data) {
  return request({
    url: '/api/v1/tm-member',
    method: 'post',
    data: data
  })
}

// 修改TmMember
export function updateTmMember(data) {
  return request({
    url: '/api/v1/tm-member/' + data.id,
    method: 'put',
    data: data
  })
}

// 删除TmMember
export function delTmMember(data) {
  return request({
    url: '/api/v1/tm-member',
    method: 'delete',
    data: data
  })
}

// 获取API Key
export function getMyKey() {
  return request({
    url: '/api/v1/tm-member/api-key',
    method: 'get'
  })
}

// 获取使用量统计
export function getTranslateDataStatistic() {
  return request({
    url: '/api/v1/translate/datastatistics',
    method: 'get'
  })
}

// 字符充值
// export function tmMemberRecharge(data) {
//   return request({
//     url: '/api/v1/tm-member/recharge',
//     method: 'post',
//     data: data
//   })
// }

// 管理员充值
export function tmMemberManageRecharge(data) {
  return request({
    url: '/api/v1/tm-member/manager-recharge',
    method: 'post',
    data: data
  })
}

// 管理员扣除字符
export function tmMemberManageDeduct(data) {
  return request({
    url: '/api/v1/tm-member/manager-deduct',
    method: 'put',
    data: data
  })
}

export function changeTmMemberStatus(data) {
  return request({
    url: '/api/v1/tm-member/status',
    method: 'put',
    data: data
  })
}
