package com.lukouguoji.aerologic.page.message.details

import android.content.Context
import android.content.Intent
import android.os.Bundle
import com.lukouguoji.aerologic.R
import com.lukouguoji.aerologic.databinding.ActivityMessageDetailsBinding
import com.lukouguoji.module_base.base.BaseBindingActivity
import com.lukouguoji.module_base.bean.MessageBean
import com.lukouguoji.module_base.common.Constant
import com.lukouguoji.module_base.ktx.toJson

class MessageDetailsActivity :
    BaseBindingActivity<ActivityMessageDetailsBinding, MessageDetailsViewModel>() {

    override fun layoutId(): Int {
        return R.layout.activity_message_details
    }

    override fun viewModelClass(): Class<MessageDetailsViewModel> {
        return MessageDetailsViewModel::class.java
    }

    override fun initOnCreate(savedInstanceState: Bundle?) {
        setBackArrow("消息展示")
        binding.viewModel = viewModel

        viewModel.onCreated(intent)
    }

    companion object {
        @JvmStatic
        fun start(context: Context, bean: MessageBean) {
            val starter = Intent(context, MessageDetailsActivity::class.java)
                .putExtra(Constant.Key.DATA, bean.toJson(false))
            context.startActivity(starter)
        }
    }
}