package com.yidianling.consultant.modular

import android.app.Activity
import android.content.Context
import android.content.Intent
import android.support.v4.app.Fragment
import com.alibaba.android.arouter.facade.annotation.Route
import com.yidianling.consultant.ExpertSearchActivity
import com.yidianling.consultant.ExpertSearchFragment
import com.yidianling.consultant.api.IConsultantService
import com.yidianling.consultant.bean.Keyworks
import com.yidianling.consultant.data.ConsultantDataManager
import com.yidianling.consultant.modular.singlton.ConsultAssistantDialogUtils

/**
 * Created by xj on 2019/11/14.
 */

@Route(path = "/consultant/ConsultantService")
class ConsultantServiceImp: IConsultantService {

    override fun init(context: Context?) {
    }

    override fun expertSearchIntent(activity: Activity, category: Int, showType: Int, isInitShowHot: Boolean): Intent {
        return ExpertSearchActivity.newIntent(activity, category, showType, isInitShowHot)
    }

    override fun getHotSearch(): MutableList<Keyworks> {
        return ConsultantDataManager.getRam().getHotSearch();
    }

    override fun setHotSearch(hotSearch: MutableList<Keyworks>) {
        return ConsultantDataManager.getRam().setHotSearch(hotSearch);
    }

    /**
     * 首页咨询助理入口
     */
    override fun showConsultAssistantDialog(activity: Activity) {
        ConsultAssistantDialogUtils.INSTANCE.fitRequest(activity, "home_index")
    }

    override fun hideConsultAssistantDialog() {
        ConsultAssistantDialogUtils.INSTANCE.hideFromHomePage()
    }

    override fun startExpertSearchActivity(
        mContext: Context,
        category: Int,
        categoryName: String,
        showType: Int
    ) {
        ExpertSearchActivity.start(mContext, category, categoryName, showType)
    }

    override fun startExpertSearchActivity(mContext: Context, category: Int) {
        ExpertSearchActivity.start(mContext, category)
    }

    override fun getExpertSearchFragment(): Fragment {
        return ExpertSearchFragment()
    }

    override fun resetConsultAssistantDialogStatus() {
        ConsultAssistantDialogUtils.INSTANCE.resetStatus()
    }

}