import { BaseDefine, MultipleQuery, MultipleResult } from './base'

/** 消息接口 */

export namespace Message {
  interface BaseMessageResponse {
    id: number
    content: string
    receiveUserId: number
    receiveUserName: string
    sendTime: string
    sendUserId: number
    sendUserName: string
    unReadCount: number
  }
  /** 历史消息 */
  type GetMessageHistory = BaseDefine<{ sendUserId: number }, BaseMessageResponse[]>
  /** 消息列表 */
  type GetMessageList = BaseDefine<null, BaseMessageResponse[]>
  /** 发送/回复消息 */
  type SendMessage = BaseDefine<{ content: string; receiveUserIds: number[] }>
  /** 未读消息 - 最新5条 */
  type GetUnReadMessage = BaseDefine<null, { newCount: number; messages: BaseMessageResponse[] }>
  /** 已读 */
  type HandleReadMessage = BaseDefine<{ id: number }>
  export interface ApiMap {
    /** 历史消息 */
    getMessageHistory: GetMessageHistory
    /** 消息列表 */
    getMessageList: GetMessageList
    /** 发送/回复消息 */
    sendMessage: SendMessage
    /** 未读消息 - 最新5条 */
    getUnReadMessage: GetUnReadMessage
    /** 已读 */
    handleReadMessage: HandleReadMessage
  }
}
