import { request } from '@/utils/request'

/**
 * @query agentId 应用Id channel 渠道
 * @returns 应用用量数据
 */
export function fetchGetGeneralUsageData<T>(agentId: string, channel: string[]) {
  return request.post<T>(`/agentDataAnalyzeRest/getGeneralUsageData.json?agentId=${agentId}&channel=${channel}`)
}

/**
 * @params payload
 * @returns 应用趋势图数据
 */
export function fetchGetAgentDataTrend<T>(payload: {
  agentId: string
  channel: string[]
  timeRange: { rangType: string; startTime: string; endTime: string }
}) {
  return request.post<T>('/agentDataAnalyzeRest/getAgentDataTrend.json', payload)
}

/**
 * @query agentId 应用Id channel 渠道
 * @returns 本月使用人数据
 */
export function fetchGetMonthUserCount<T>(agentId: string, channel: string[]) {
  return request.post<T>(`/agentDataAnalyzeRest/getChannelUsersCount.json?agentId=${agentId}&channel=${channel}`)
}

/**
 * @query agentId 应用Id channel 渠道
 * @returns 本月发送消息数据
 */
export function fetchGetMonthSendMessageCount<T>(agentId: string, channel: string[]) {
  return request.post<T>(`/agentDataAnalyzeRest/getSendMessageCount.json?agentId=${agentId}&channel=${channel}`)
}

/**
 * @query agentId 应用Id channel 渠道
 * @returns 本月消耗积分数据
 */
export function fetchGetMonthConsumePointCount<T>(agentId: string, channel: string[]) {
  return request.post<T>(`/agentDataAnalyzeRest/getPointUsageCount.json?agentId=${agentId}&channel=${channel}`)
}
