import request from '@/config/axios'

// 事件记录 VO
export interface EventRecordVO {
  id: number // id
  userId: string // 用户id
  url: string // 事件地址
  metricId: number // 事件指标id
  date: Date // 日期
  count: number // 总次数
}

// 事件记录 API
export const EventRecordApi = {
  // 查询事件记录分页
  getEventRecordPage: async (params: any) => {
    return await request.get({ url: `/menduner/reward/event-record/page`, params })
  },

  // 查询事件记录详情
  getEventRecord: async (id: number) => {
    return await request.get({ url: `/menduner/reward/event-record/get?id=` + id })
  },

  // 新增事件记录
  createEventRecord: async (data: EventRecordVO) => {
    return await request.post({ url: `/menduner/reward/event-record/create`, data })
  },

  // 修改事件记录
  updateEventRecord: async (data: EventRecordVO) => {
    return await request.put({ url: `/menduner.reward/event-record/update`, data })
  },

  // 删除事件记录
  deleteEventRecord: async (id: number) => {
    return await request.delete({ url: `/menduner.reward/event-record/delete?id=` + id })
  },

  // 导出事件记录 Excel
  exportEventRecord: async (params) => {
    return await request.download({ url: `/menduner.reward/event-record/export-excel`, params })
  }
}