import { BooleanFlag } from '@/constants'

/**
 * 发送私信的参数
 */
export interface SendMessageDto {
  content: string
  chatType: BooleanFlag // 0 实名 1 匿名
  senderId: string
  receiverId: string
  images: string
}

/**
 * 获取私信列表的参数
 */
export interface GetMessageListDto {
  chatType?: BooleanFlag
  search?: string
}

/**
 * 获取私信列表的响应
 */
export interface ConversationResponseDto {
  anonymousUnreadCount: number
  realUnreadCount: number
  totalUnreadCount: number
  dialogList: ConversationItem[]
}

export interface ConversationItem {
  chat_type: string
  chat_type_desc: string
  had_read: number
  id: number
  is_self_last_msg: boolean
  last_message: string
  last_message_prefix: string
  last_sender_name: string
  last_time: string
  last_time_str: string
  last_user_id: string
  other_user_account: string
  other_user_avatar: string
  other_user_id: string
  other_user_name: string
  status: number
  un_read_count: number
}

/**
 * 获取私信详情的列表参数
 */
export interface GetMessageDetailListDto {
  receiverId: string
  dialogId: number
  chatType: BooleanFlag
}

/**
 * 获取私信详情的列表响应
 */
export interface MessageDetailListItem {
  images: string
  relation_status: number
  create_time: string
  receiver_id: string
  message_id: number
  sender_name: string
  sender_avatar: string
  content: string
  sender_id: string
  relation_id: number
  create_time_str: string
  is_anonymous: boolean
  dialog_id: number
  is_self: boolean
  image_list: string[]
}

/** 删除私信：会话或单条消息 */
export type DeleteCultureMessageKind = 'user' | 'message'

export interface DeleteMessageDto {
  /** user：按会话删除；message：按消息删除 */
  type: DeleteCultureMessageKind
  /** 会话 id 列表或消息 id 列表 */
  idList: number[]
}
