package com.renrenliao.im.utils

import android.content.Context
import android.content.Intent
import com.renrenliao.im.bean.UserInfo
import com.renrenliao.im.im.AlarmEntity
import com.renrenliao.im.provider.ClarityPotion
import com.renrenliao.im.ui.activity.*

object RouteUtils {



    //退出跳转到登陆
    fun exitAndLogin() {
        ClarityPotion.finishAllActivity()
        //APP中所有的activity都已被回收 借助 全局Context
        val intent = Intent()
        val context = ClarityPotion.healingSalve
        intent.setClass(context, LoginActivity::class.java)
            .flags = Intent.FLAG_ACTIVITY_NEW_TASK
        context.startActivity(intent)
    }


    fun gotoMain(context: Context) {
        val intent = Intent()
        intent.setClass(context, MainActivity::class.java)
        context.startActivity(intent)

    }

    fun gotoLogin(context: Context) {
        val intent = Intent()
        intent.setClass(context, LoginActivity::class.java)
        context.startActivity(intent)
    }

    fun gotoSetting(context: Context) {
        val intent = Intent()
        intent.setClass(context, SettingActivity::class.java)
        context.startActivity(intent)
    }

    fun gotoUserInfo(context: Context) {
        val intent = Intent()
        intent.setClass(context, UserInfoActivity::class.java)
        context.startActivity(intent)
    }

    fun gotoBigImage(context: Context,url: String){
        val intent = Intent()
        intent.setClass(context, BigImageActivity::class.java)
        intent.putExtra("url",url)
        context.startActivity(intent)
    }

    fun gotoGroupList(context: Context){
        val intent = Intent()
        intent.setClass(context,GroupListActivity::class.java)
        context.startActivity(intent)
    }

    fun gotoGroupMember(context: Context){
        val intent = Intent()
        intent.setClass(context,GroupCreateActivity::class.java)
        context.startActivity(intent)
    }

    fun gotoFriendSearch(context: Context){
        val intent = Intent()
        intent.setClass(context,FriendSearchActivity::class.java)
        context.startActivity(intent)
    }

    fun gotoFriendInfo(context: Context,userInfo: UserInfo){
        val intent = Intent()
        intent.setClass(context,FriendInfoActivity::class.java)
        intent.putExtra("userinfo",userInfo)
        context.startActivity(intent)
    }

    fun gotoFriendAdd(context: Context,userInfo: UserInfo){
        val intent = Intent()
        intent.setClass(context,FriendAddActivity::class.java)
        intent.putExtra("userinfo",userInfo)
        context.startActivity(intent)
    }

    fun gotoFriendCircle(context: Context){
        val intent = Intent()
        intent.setClass(context,FriendCircleActivity::class.java)
        context.startActivity(intent)
    }

    fun gotoAccountSafe(context: Context){
        val intent = Intent()
        intent.setClass(context,AccountSafeActivity::class.java)
        context.startActivity(intent)
    }

    fun gotoVerification(context: Context){
        val intent = Intent()
        intent.setClass(context,VerificationActivity::class.java)
        context.startActivity(intent)
    }

    fun gotoProcessAddFriend(context: Context,alarmEntity: AlarmEntity){
        val intent = Intent()
        intent.setClass(context,ProcessAddFriendActivity::class.java)
        intent.putExtra("alarm",alarmEntity)
        context.startActivity(intent)
    }
}