package com.sybotan.android.demo.tools

import android.text.TextUtils
import com.framework.mvvm.model.db.entity.task.ObjectEntity
import com.google.gson.JsonElement

/**
 * Created by lihao.
 * Date: 2021/11/18
 */
class ObjectNameUtils {

    companion object {
        fun getEquipName(objectEntity: ObjectEntity?): String {
            if (objectEntity != null && objectEntity.infos == null) {
                return "--"
            }
            if (objectEntity?.classCode!!.contains("SELTCC") || (!TextUtils.isEmpty(objectEntity?.name) && objectEntity?.name!!.contains("照明回路"))) {
                return if (TextUtils.isEmpty(objectEntity.localId)) "--" else objectEntity.localId.toString()
            }
            val infos = objectEntity?.infos?.asJsonObject
            return if (infos?.get("digitalDeliveryID") == null) "--" else infos.get("digitalDeliveryID").toString()
        }
    }

}