package com.zj365.health.act.binddevice

import android.view.View
import com.alibaba.android.arouter.facade.annotation.Route
import com.xty.base.act.BaseVmAct
import com.xty.base.vm.BaseVm
import com.xty.common.arouter.ARouterUrl
import com.zj365.health.databinding.ActBodyFatItemDetailBinding
import com.xty.network.model.BodyFatBean

@Route(path = ARouterUrl.BODY_FAT_ITEM_DETAIL)
class BodyFatItemDetailAct : BaseVmAct<BaseVm>() {

    val binding by lazy { ActBodyFatItemDetailBinding.inflate(layoutInflater) }
    private var itemDetail: BodyFatBean.Label? = null

    override fun liveObserver() {
    }

    override fun setLayout(): View = binding.root

    override fun initData() {
        super.initData()
        itemDetail = intent.getSerializableExtra("itemDetail") as BodyFatBean.Label?
    }

    override fun initView() {
        super.initView()
        statusBar(binding.titleBar.mView)
        binding.titleBar.mIvBack.setOnClickListener { finish() }
        binding.titleBar.mTvTitle.text = "体脂报告详情"

        itemDetail?.apply {
            binding.tvDetail.text = labelContent
            binding.eatDetail.text = labelDietaryAdvice
            binding.sportDetail.text = labelSportsAdvice

            if (labelContent == null && labelDietaryAdvice == null && labelSportsAdvice == null){
                binding.llNoDataLayout.visibility = View.VISIBLE
                binding.content.visibility = View.GONE
            }
        }

        if (itemDetail == null){
            binding.llNoDataLayout.visibility = View.VISIBLE
            binding.content.visibility = View.GONE
        }

        binding.tvBack.setOnClickListener {
            finish()
        }
    }
}