package com.renrenliao.im.bean

import android.os.Parcelable
import androidx.room.Entity
import androidx.room.Ignore
import androidx.room.Index
import androidx.room.PrimaryKey
import com.renrenliao.im.config.Const
import kotlinx.android.parcel.Parcelize

/**
 **@ClassName AppConfigEntity
 **@Description
 **@Author gan
 **@Date 2022/5/24 16:00
 **/


@Entity(tableName = "student")
data class StudentEntity(
    @PrimaryKey
    val id: Int,
    val name: String,
    val age: Int,
    val sex: Boolean
)

@Parcelize
data class LineEntity(
    val name: String,
    val server: List<LineItem>,
    val version: Int
):Parcelable

@Parcelize
data class LineItem(
    val apiUrl: String,
    val imAddr: String,
    val imPort: String,
    val name: String,
    val uploadUrl: String,
    var select:Boolean = false
):Parcelable

/**
 * {"withdrawMinAmount":"100","androidAddress":"https://rrim.oss-cn-beijing.aliyuncs.com/renrenliao.apk","useMobileRegister":"0","versionStatus":1,"iosAtt1":"抖一抖","redPackBlessing":"恭喜發財","iosAtt2":"https://apimg.alipay.com/","ob":"1","iosAtt3":"https://ccdcapi.alipay.com/","apiUrl":"http://47.108.176.248","inviteSwitch":"0","imPort":"9903","payAddress":"http://api.renrenim.com/defray/#/?payKey=138625c0fc6e4b28934f3e85fd02526e&vipUserId=10013016","aliyunoss":"https://renrenim.seelinok.com/avatar/","withdrawRate":"0.1","iosAddress":"https://tf.kekouyun.vip/app/1578110577","iosForceUpdateVersion":"100","iosUpdateContent":"当前最新版本:1.0.1。#@1.UI改版#@2.针对部分机型修复了bug#@3.优化消息收发","avatarVersion":"1589530066000","userTerms":"https://im.177.me/legal.html","iosVersion":"100","androidTitle":"系统升级","openAuth":"0","androidUpdateContent":"当前最新版本:1.8.0。#@1.UI改版#@2.针对部分机型修复了bug#@3.优化消息收发","uploadUrl":"http://josn.renrenim.net:100","iosTitle":"人人聊升级","headImgRefreshTime":"86400000","payJump":"0","imAddr":"47.108.176.248"}
 **/

@Parcelize
data class AppConfigEntity(
    val aliyunoss: String?,
    val androidAddress: String,
    val androidTitle: String,
    val androidUpdateContent: String,
    val apiUrl: String,
    val avatarVersion: String,
    val headImgRefreshTime: String,
    val imAddr: String,
    val imPort: String,
    val inviteSwitch: String,
    val iosAddress: String,
    val iosAtt1: String,
    val iosAtt2: String,
    val iosAtt3: String,
    val iosForceUpdateVersion: String,
    val iosTitle: String,
    val iosUpdateContent: String,
    val iosVersion: String,
    val ob: String,
    val openAuth: String,
    val payAddress: String,
    val payJump: String,
    val redPackBlessing: String,
    val uploadUrl: String,
    val useMobileRegister: String,
    val userTerms: String,
    val versionStatus: Int,
    val withdrawMinAmount: String,
    val withdrawRate: String
) : Parcelable

@Parcelize
data class AuthInfo(
    val authed_info: UserInfo
) : Parcelable

@Entity(
    //表名
    tableName = "friend",
    //索引
    indices = [Index(value = ["account_uid", "userUid"], unique = true)]
)
@Parcelize
data class UserInfo(
    @PrimaryKey(autoGenerate = true)
    var id: Int ,
    var account_uid: String? ="",  //自己的uid
    var accessToken: String? ="",
    var areaCode: String? ="",     //+86
    var authStatus: Int =0,
    var balance: Double =0.0,    //1.28
    var chatid: String? ="",     //test_PCfRB0J 用户聊天的id 后台自动生成
    var expiresIn: Int =0,     //0
    var friendVerification: Int =0,  //1
    var grade: Int =0,                //0
    var gId: String? = "",
    var invitationCode: String? ="",  // 邀请码
    var isInsider: Int =0,          //0
    var isOnline: Int =0,            //0
    var latestLoginIp: String? ="",    //45.195.40.2
    var latestLoginTime: String? ="",  //2022-05-30 17:52:55
    var liveStatus: Int =0,      //0
    var logoutTime: String? ="",   //2022-05-28 20:37:07
    var maxFriend: Int =0,       //20
    var mobile: String? ="",       //ganzhe
    var nickname: String? ="",    //gzc
    var payPassword: String? ="",
    var registerIp: String ?="",   //45.195.40.2
    var registerTime: String? ="", //2022-05-13 13:16:57
    var token: String? ="",
    var totalOnlineSecond: String? ="",  //152837995
    var userAvatarFileName: String? ="", //https://renrenim.oss-accelerate.aliyuncs.com/avatar/user/10026290/10026290.png"
    var userRegieon: String? ="",       //香港
    var userSex: Int =0,              //3
    var userStatus: Int =0,           //1
    var userType: Int =0,             //0
    var userUid: String ="",               //3
    var whatsUp: String? ="",             //说点什么吧......
    var userDesc: String? ="",          //你以为还能说啥......
    var buddyRemark:String? ="",     //备注
    var ex1:String? = "",
    var ex10:String? = "",
    var avatarVersion:Long = 0
) : Parcelable{
    @Ignore
    constructor():this(id = 0)
    @Ignore
    var ext11:Boolean = false /** @see com.renrenliao.im.ui.adapter.GroupMemberAdapter 扩展字段*/

    fun getRemark():String{
        return if (buddyRemark?.isBlank()==true){
            nickname.toString()
        }else{
            buddyRemark.toString()
        }
    }
    fun getAvatarUrl():String{
        return  Const.COMMON_IMG_USER_FILE + avatarVersion+"/"+avatarVersion+".png"
    }
}


data class LoginExtra(
    val accessToken: String,
    val modleType: String = "android"
) {
    constructor(accessToken: String) : this(accessToken, "android")
}

data class BankCardEntity(
    val addTime: Long,
    val bankAccountAddress: String,
    val bankCardAvatar: String,
    val bankCardNumber: String,
    val bankCardTailNumber: String,
    val bankCode: String,
    val bankName: String,
    val id: Int,
    val isNotDel: Int,
    val updateTime: Long,
    val userName: String,
    val userUid: Int
)

//@Entity(
//    //表名
//    tableName = "avatarTag",
//    //索引
//    indices = [Index(value = ["account_uid", "uid"], unique = true)]
//)
//data class AvatarTAG(
//    @PrimaryKey(autoGenerate = true)
//    var id: Int =0 ,
//    var account_uid: String="",  //自己的uid
//    var uid:String="" ,//用户uid
//    var version:Long = 0, //头像版本
//){
//    @Ignore
//    constructor():this(id = 0)
//}

