package com.xhly.manageapp.utils

import android.content.Context
import android.os.Build
import com.xhly.corelib.Const
import com.xhly.corelib.utils.FileSizeUtils
import com.xhly.corelib.utils.SharedPreferencesUtils
import com.xhly.corelib.utils.SystemUtil
import com.xhly.manageapp.ManageApplication
import com.xhly.manageapp.bean.log.PadInfoBean
import com.xhly.manageapp.bean.user.UserBean

class PadInfoUtils {

    fun getPadInfo(context: Context,simIccID:String):PadInfoBean{
        val spUtils by lazy { SharedPreferencesUtils.getInstance(context) }
       val json= spUtils.getFromJson(Const.USERINFO, UserBean().javaClass)
        val padInfoBean = PadInfoBean()
        json?.let {
            val userBean = it as UserBean
            padInfoBean.userid=userBean.userid
            padInfoBean.schoolid=userBean.schoolid
            padInfoBean.regionid=userBean.regionid
            ManageApplication.getDeviceInfo()?.let {sn->
                padInfoBean.sn=sn
            }
            padInfoBean.deviceModel= Build.MODEL
            padInfoBean.deviceVersion=Build.VERSION.CODENAME
            padInfoBean.wifyMac=SystemUtil.getWifiMac(context)
            padInfoBean.blueMac=SystemUtil.getBluetoothMac()
            padInfoBean.sysKernel=SystemUtil.getKernelVersion()
            padInfoBean.deviceName=Build.DEVICE
            padInfoBean.root=if (SystemUtil.isSuEnable()) 1 else 0
            padInfoBean.romVersion=Build.DISPLAY
            padInfoBean.sim=simIccID
            padInfoBean.totalMemory=FileSizeUtils.getTotalSpace(context)
            padInfoBean.usedMemory=FileSizeUtils.getFreeSpace(context)
        }
        return padInfoBean
    }
}