package com.bc_chat.account

import android.app.Activity
import com.alibaba.android.arouter.facade.annotation.Route
import com.bc_chat.account.fragment.Step1ForgetPwdFragment
import com.bc_chat.account.fragment.Step2ForgetPwdFragment
import com.bc_chat.account.presenter.ForgetPresenter
import com.bc_chat.bc_base.config.RouteConfig
import com.zhaohaoting.framework.abs.BaseActivity
import com.zhaohaoting.framework.abs.contract.BaseContract
import org.jetbrains.anko.bundleOf

/**
 * author：Created by zhaohaoting on 2019/2/21
 * email：526309416@qq.com
 * desc：忘记密码
 */
@Route(path = RouteConfig.FORGET_PASSWORD_ACTIVITY)
class ForgetPasswordActivity : BaseActivity<BaseContract.BasePresenter>() {

    override fun initPresenter(): ForgetPresenter? = null

    override fun initialize() {
        val step1Fragment = Step1ForgetPwdFragment()
        addFragment(step1Fragment, R.id.fl_content)
        step1Fragment.setNextListener { phone, verCode ->
            val step2Fragment = Step2ForgetPwdFragment()
            step2Fragment.arguments = bundleOf("phone" to phone, "verCode" to verCode)
            addFragment(step2Fragment, R.id.fl_content)
            step2Fragment.setConfirmListener {
                setResult(Activity.RESULT_OK)
                finish()
            }
        }
    }

    override fun getLayoutResId(): Int {
        return R.layout.activity_forget_password
    }
}