package com.doverfuelingsolutions.issp.utils

import android.annotation.SuppressLint
import android.os.Build

class DeviceUtil {

    companion object {

        private const val SN_PREFIX = "QJ_"
        private var sn = ""

        fun querySN(): String {
            if (sn.isEmpty()) {
                // val deviceSN = rawSN()
                val deviceSN = "4f49a5dbfbf7c6a6" // FIXME 测试代码
                sn = if (deviceSN == "03778700666" || deviceSN == "03492200711" || deviceSN == "f02b5d95d98833d3" || deviceSN == "cf811453a0548b77") {
                    SN_PREFIX + deviceSN.substring(0, deviceSN.length - SN_PREFIX.length)
                } else {
                    SN_PREFIX + deviceSN
                }
            }
            return sn
        }

        @SuppressLint("HardwareIds")
        @Suppress("DEPRECATION")
        fun rawSN(): String = Build.SERIAL
    }
}