package com.yidianling.tests.router

import android.app.Activity
import android.content.Intent
import com.ydl.ydl_router.manager.YDLRouterManager
import com.ydl.ydl_router.manager.YDLRouterParams
import com.yidianling.router.tests.ITestsRouter
import com.yidianling.tests.answer.TestAnswerActivity
import com.yidianling.tests.detail.TestDetailActivity
import com.yidianling.tests.result.jump.JumpTestResultActivity
import com.yidianling.ydlcommon.BuildConfig
import com.yidianling.ydlcommon.router.IYDLRouterConstant

class TestsRouterImp : ITestsRouter {

    override fun testH5Result(testResultId: String) {
        YDLRouterManager.router(IYDLRouterConstant.ROUTER_H5_H5,
                YDLRouterParams().putExtra(IYDLRouterConstant.EXTRA_URL, BuildConfig.MH5_URL+"ceshi/result/"+testResultId),"")
    }

    override fun testDetailH5(testId: String) {
        YDLRouterManager.router(IYDLRouterConstant.ROUTER_H5_H5,
                YDLRouterParams().putExtra(IYDLRouterConstant.EXTRA_URL, BuildConfig.MH5_URL+"ceshi/"+testId),"")
    }

    override fun testDetailIntent(activity: Activity, testId: Int): Intent {
        return TestDetailActivity.newIntent(activity, testId.toString())
    }

    override fun testResultIntent(activity: Activity, testResultId: Int): Intent {
        return JumpTestResultActivity.newIntent(activity, testResultId.toString())
    }

    override fun testAnswerIntent(activity: Activity): Intent {
        return TestAnswerActivity.newIntent(activity)
    }

}