import axios from '../axios'

/**
 * 线下充值 - 请求方法（SAAS 端）
 * 接口文档：@e:\zzq\saas-manage\图\jomalls-mange端账户相关接口.md
 * 基础路径：/api/offline-recharge（需 token 校验）
 */

const BASE = '/offline-recharge'

// ==================== 1. 左边栏状态统计 ====================
// POST /api/offline-recharge/status
// 响应：[ { code, remark, num } ]
export function getOfflineRechargeStatus() {
  return axios.post(`${BASE}/status`)
}

// ==================== 2. 运营初审 ====================
// POST /api/offline-recharge/firstAudit
// 请求体 OfflineRechargeRecordParam：{ id, audit(boolean), rejectReason? }
export function firstAudit(data) {
  return axios.post(`${BASE}/firstAudit`, data)
}

// ==================== 3. 财务复审 ====================
// POST /api/offline-recharge/secondAudit
// 请求体 OfflineRechargeRecordParam：{ id, audit(boolean), rejectReason?, actualAmount?, serviceFee?, financeBillUrl?, financeRemark? }
export function secondAudit(data) {
  return axios.post(`${BASE}/secondAudit`, data)
}

// 状态码 -> 文案 映射
export const OFFLINE_RECHARGE_STATUS_MAP = {
  OPER_APPROVED: '运营初审',
  FIN_APPROVED: '财务复审',
  SETTLED_AMOUNT: '充值成功',
  WAIT_UPDATE: '充值失败'
}
