import { CHAT_CONST_LIST } from '@/config/chat'
import { DisplayMessage } from '@/store/messagesStore'
import { eRole } from '@/types/roleType'

export default class ChatDataService {
  static instance: ChatDataService
  static getInstance() {
    if (!ChatDataService.instance)
      ChatDataService.instance = new ChatDataService()
    return ChatDataService.instance
  }

  extractCommonMsgContentFromMsg(msg: DisplayMessage, role: eRole) {
    const userId = msg.content.bank
    const CONST = CHAT_CONST_LIST.find((i) => i.user.id === userId)
    return eRole.user === role ? CONST?.user.value : CONST?.staff.value
  }
}
