package com.zj365.mime.act

import android.view.View
import androidx.recyclerview.widget.LinearLayoutManager
import com.alibaba.android.arouter.facade.annotation.Route
import com.xty.base.act.BaseListAct
import com.xty.common.arouter.ARouterUrl
import com.zj365.mime.adapter.EnterpriseInformationChildAdapter
import com.zj365.mime.databinding.ActEnterpriseInformationTypeBinding
import com.zj365.mime.vm.EnterpriseInformationVm
@Route(path = ARouterUrl.ENTERPRISE_TYPE_INFO)
class EnterpriseInformationForTypeAct : BaseListAct<EnterpriseInformationVm>() {

    val binding by lazy { ActEnterpriseInformationTypeBinding.inflate(layoutInflater) }

    val mAdapter by lazy { EnterpriseInformationChildAdapter(1) }

    var type = 0
    override fun initAdapter() {
        binding.mRecycle.adapter = mAdapter
        binding.mRecycle.layoutManager = LinearLayoutManager(this@EnterpriseInformationForTypeAct)

        setRecycleRefresh(binding.mRecycle,binding.mRefresh,true)
    }


    override fun initView() {
        super.initView()
        statusBar(binding.title.mView)
        binding.title.mTvTitle.text = "企业资料"
        binding.title.mIvBack.setOnClickListener {
            finish()
        }


    }

    override fun loadData() {
        type = intent.getIntExtra("type",0)
        mViewModel.getEnterpriseInformationForType(type,page)
    }

    override fun liveObserver() {
        mViewModel.enterpriseInfoForTypeLiveData.observe(this){
            setDate(mAdapter,it.data.list)
        }
    }

    override fun setLayout() = binding.root
}