package com.bc_chat.bc_base.entity

import android.os.Parcel
import android.os.Parcelable
import com.google.gson.annotations.SerializedName
import org.litepal.crud.LitePalSupport

/**
 * author：Created by zhaohaoting on 2019/2/22
 * email：526309416@qq.com
 * desc：
 */
class User constructor(@SerializedName("uid") var userId: String = "") : Parcelable, LitePalSupport() {
    @SerializedName("token")
    var accessToken: String? = ""
    var phone: String? = ""
    var photo: String? = ""
    var nickname: String? = ""
    var introduction: String? = ""//   简介
    var remark: String? = null//   备注
    var province: String? = ""//    省份
    var city: String? = ""//   城市
    var is_block: Int? = 0//    0-未拉黑 1-已拉黑
    var is_report: Int? = 0//   0-未举报 1-已举报
    var is_myFriend: Int? = 0 //0-非好友 1-好友
    @SerializedName("end_time")
    var endTime: String? = "0"
    var type: Int? = 1// "2", //1-开 2-关闭1小时 3-关闭8小时 4-关闭2天 5-关闭（提示：为null时即表示尚未初次设置，为默认值）
    var disturbTime: Int? = 1// "2", //1-开 2-关闭1小时 3-关闭8小时 4-关闭2天 5-关闭（提示：为null时即表示尚未初次设置，为默认值）


    constructor(parcel: Parcel) : this(parcel.readString()) {
        accessToken = parcel.readString()
        phone = parcel.readString()
        photo = parcel.readString()
        nickname = parcel.readString()
        introduction = parcel.readString()
        remark = parcel.readString()
        province = parcel.readString()
        city = parcel.readString()
        is_block = parcel.readValue(Int::class.java.classLoader) as? Int
        is_report = parcel.readValue(Int::class.java.classLoader) as? Int
        is_myFriend = parcel.readValue(Int::class.java.classLoader) as? Int
        endTime = parcel.readString()
        type = parcel.readValue(Int::class.java.classLoader) as? Int
    }

    override fun writeToParcel(parcel: Parcel, flags: Int) {
        parcel.writeString(userId)
        parcel.writeString(accessToken)
        parcel.writeString(phone)
        parcel.writeString(photo)
        parcel.writeString(nickname)
        parcel.writeString(introduction)
        parcel.writeString(remark)
        parcel.writeString(province)
        parcel.writeString(city)
        parcel.writeValue(is_block)
        parcel.writeValue(is_report)
        parcel.writeValue(is_myFriend)
        parcel.writeString(endTime)
        parcel.writeValue(type)
    }

    override fun describeContents(): Int {
        return 0
    }

    companion object CREATOR : Parcelable.Creator<User> {
        override fun createFromParcel(parcel: Parcel): User {
            return User(parcel)
        }

        override fun newArray(size: Int): Array<User?> {
            return arrayOfNulls(size)
        }
    }


}
