package com.renrenliao.im.im

import com.renrenliao.im.bean.UserInfo
import com.renrenliao.im.utils.DataCacheUtils
import com.renrenliao.im.utils.LogUtils
import com.renrenliao.im.utils.MDateUtils
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext

object AlarmHelper {

    fun createAddFriendAlarm(friend: UserInfo):AlarmEntity{
        val alarmEntity = AlarmEntity()
        alarmEntity.account_uid = DataCacheUtils.getUid()
        alarmEntity.msgType = AlarmType.ADDFRIENDREQUEST.value
        alarmEntity.name = "确认提醒"
        alarmEntity.msg = "${friend.getRemark()} 邀请您成为好友"

        var reqTime = if (friend.ex10 ==null || friend.ex10?.isBlank() == true){
            MDateUtils.currentTimMillis()
        }else{
            friend.ex10?.toLong()!!
        }

        alarmEntity.time = reqTime
        alarmEntity.num = 1
        alarmEntity.setSingleChatInfo(friend)
        return  alarmEntity
    }

    fun createSingleAlarm(friend: UserInfo):AlarmEntity{
        val alarmEntity = AlarmEntity()
        alarmEntity.edit = ""
        alarmEntity.account_uid = DataCacheUtils.getUid()
        alarmEntity.msgType = AlarmType.REVICEMESSAGE.value
        alarmEntity.name = friend.getRemark()
        alarmEntity.msg = friend.getRemark()+"已是你的好友了,点击开始聊天吧..."
        alarmEntity.time = MDateUtils.currentTimMillis()
        alarmEntity.num = 0
        alarmEntity.setSingleChatInfo(friend)
        return alarmEntity
    }




}