import request from '@/config/axios'

export interface NotifyMessageVO {
  id: number
  userId: number
  userType: number
  templateId: number
  templateCode: string
  templateNickname: string
  templateContent: string
  templateType: number
  templateParams: string
  readStatus: boolean
  readTime: Date
}

// 查询站内信消息列表
export const getNotifyMessagePage = async (params: any) => {
  return await request.get({ url: '/admin-api/system/notify-message/page', params })
}

// 获得我的站内信分页
export const getMyNotifyMessagePage = async (params: any) => {
  return await request.get({ url: '/admin-api/system/notify-message/my-page', params })
}

// 批量标记已读
export const updateNotifyMessageRead = async (data: any) => {
  return await request.put({
    url: '/admin-api/system/notify-message/update-read?',
    data
  })
}

// 标记所有站内信为已读
export const updateAllNotifyMessageRead = async (data: any) => {
  return await request.put({ url: '/admin-api/system/notify-message/update-all-read', data })
}

// 获取当前用户的最新站内信列表
export const getUnreadNotifyMessageList = async (params: any) => {
  return await request.get({ url: '/admin-api/system/notify-message/get-unread-list', params })
}

// 获得当前用户的未读站内信数量
export const getUnreadNotifyMessageCount = async (params: any) => {
  return await request.get({ url: '/admin-api/system/notify-message/get-unread-count', params })
}

// 获取详情
export const getNotifyMessageDetail = async (id: number) => {
  return await request.get({ url: '/admin-api/system/notify-message/get', params: { id } })
}
