package cn.yyxx.eyuangame.core.entity

import org.json.JSONObject
import java.io.Serializable

/**
 * @author #Suyghur.
 * Created on 2021/06/22
 */
class Session : Serializable {

    var userId = ""
    var userName = ""
    var pwd = ""
    var loginType = -1

    fun reset() {
        userId = ""
        userName = ""
        pwd = ""
        loginType = -1
    }

    fun toJSONObject(): JSONObject {
        val jsonObject = JSONObject()
        try {
            jsonObject.put("uid", userId)
            jsonObject.put("uname", userName)
            jsonObject.put("pwd", pwd)
            jsonObject.put("login_type", loginType)
        } catch (e: Exception) {
            e.printStackTrace()
        }
        return jsonObject
    }

    override fun toString(): String {
        return "Session(userId='$userId', userName='$userName', pwd='$pwd', loginType=$loginType)"
    }
}