import service from '@/utils/request/index'
import type {
  SendMessageDto,
  GetMessageListDto,
  ConversationResponseDto,
  GetMessageDetailListDto,
  MessageDetailListItem,
  DeleteMessageDto,
} from './types'

// 关于私信的相关接口

/**
 * 给用户发表私信
 */
export const sendMessage = (data: SendMessageDto) => {
  return service.request({
    url: '/api/cultureDialog/sendDialogMessage',
    method: 'POST',
    data,
  })
}

// 获取私信列表
export const getMessageList = (data: GetMessageListDto) => {
  return service.request<ConversationResponseDto>({
    url: '/api/cultureDialog/getDialogList',
    method: 'POST',
    data,
  })
}

// 查看某个私信详情
export const getMessageDetailList = (data: GetMessageDetailListDto) => {
  return service.request<MessageDetailListItem[]>({
    url: `/api/cultureDialog/getDialogMessageList`,
    method: 'POST',
    data,
  })
}

// 删除某个私信
export const deleteMessage = (data: DeleteMessageDto) => {
  return service.request({
    url: '/api/cultureDialog/deleteMessage',
    method: 'POST',
    data,
  })
}
