package com.base.scanqrclear.bean

import com.base.scanqrclear.bean.FunctionUIBean.Companion.KEY_X

data class XUIBean(
    val screenName: String
) : ScanBean(KEY_X) {

    companion object {

        fun isXUIBeanQR(qrCodeValue: String): Boolean {
            return qrCodeValue.startsWith("twitter://")
        }

        fun createXUIBean(qrCodeValue: String): XUIBean {
            val split = qrCodeValue.split("=")
            val screenName = if (split.size == 2) split[1] else ""
            return XUIBean(screenName)
        }

        //  twitter://user?screen_name=koko
        //  twitter://user?screen_name=www.baidu.com
        fun XUIBean.createXUIBeanQrString(): String {
            return "twitter://user?screen_name=$screenName"
        }

    }
}
