package com.qmai.zqtoolkit.config

import com.blankj.utilcode.util.DeviceUtils
import com.qmai.zqtoolkit.utils.ScaleChecker

/**
 * tongzi
 * 2022/9/7
 */
enum class SunmiPort(
    val port: String,
    val model: List<String>,

    ) {
    HSL1("ttyHSL1", listOf("d2mini", "t1", "t1mini")),
    HSL3("ttyHSL3", listOf("t2", "s1", "t2lite", "x2", "t2mini")),
    S1("ttyS1", listOf("n1", "d2", "d1s")),
    S3("ttyS3", listOf("n1_d", "d2_d", "d1s_d", "s2_cc")),
    S0("ttyS0", listOf("d2s_kds", "d2_2nd"));

    companion object {
        fun find(): String {
            var model =
                values().find { it.model.any { mod -> mod == DeviceUtils.getModel().lowercase() } }
            return model?.port
                ?: if (ScaleChecker.isDoubleScreen()) {
                    S3.port
                } else S3.port
        }
    }
}