package cn.muchinfo.rma.global.data

import android.os.Parcel
import android.os.Parcelable

/**
 * 客户资料
 * @property address String? 通讯地址
 * @property attachment1 String? 附件1
 * @property cardfrontphotourl String? 证件正面图片地址
 * @property cardnum String? 证件号码
 * @property cardtype Int? 证件类型
 * @property cardtypename String? 证件类型名称
 * @property cityid Int? 市
 * @property countryid Int? 国家
 * @property customername String? 企业名称
 * @property memberuserid Int? 所属机构ID
 * @property mobile String? 手机号码
 * @property provinceid Int? 省
 * @property remark String? 备注
 * @property status Int? 账户状态 - 1:待激活 2:待审核 3:待复审 4:正常 5:审核拒绝 6:注销
 * @property statusdesc String? 账户状态中文描述
 * @property telphone String? 联系电话
 * @property userid Int? 用户ID
 * @property userinfotype Int? 户类型
 * @property indexSelect Int
 * @constructor
 */
data class UserInfoData(
    val address: String? = "",
    val attachment1: String? = "",
    val cardfrontphotourl: String? = "",
    val cardnum: String? = "",
    val cardtype: Int? = 0,
    val cardtypename: String? = "",
    val cityid: Int? = 0,
    val countryid: Int? = 0,
    val customername: String? = "",
    val memberuserid: Int? = 0,
    val mobile: String? = "",
    val provinceid: Int? = 0,
    val remark: String? = "",
    val status: Int? = 0,
    val statusdesc: String? = "",
    val telphone: String? = "",
    val userid: Int? = 0,
    val userinfotype: Int? = 0,
    var indexSelect: Int = 0
) : Parcelable {
    constructor(parcel: Parcel) : this(
        parcel.readString(),
        parcel.readString(),
        parcel.readString(),
        parcel.readString(),
        parcel.readValue(Int::class.java.classLoader) as? Int,
        parcel.readString(),
        parcel.readValue(Int::class.java.classLoader) as? Int,
        parcel.readValue(Int::class.java.classLoader) as? Int,
        parcel.readString(),
        parcel.readValue(Int::class.java.classLoader) as? Int,
        parcel.readString(),
        parcel.readValue(Int::class.java.classLoader) as? Int,
        parcel.readString(),
        parcel.readValue(Int::class.java.classLoader) as? Int,
        parcel.readString(),
        parcel.readString(),
        parcel.readValue(Int::class.java.classLoader) as? Int,
        parcel.readValue(Int::class.java.classLoader) as? Int,
        parcel.readInt()
    ) {
    }

    override fun writeToParcel(parcel: Parcel, flags: Int) {
        parcel.writeString(address)
        parcel.writeString(attachment1)
        parcel.writeString(cardfrontphotourl)
        parcel.writeString(cardnum)
        parcel.writeValue(cardtype)
        parcel.writeString(cardtypename)
        parcel.writeValue(cityid)
        parcel.writeValue(countryid)
        parcel.writeString(customername)
        parcel.writeValue(memberuserid)
        parcel.writeString(mobile)
        parcel.writeValue(provinceid)
        parcel.writeString(remark)
        parcel.writeValue(status)
        parcel.writeString(statusdesc)
        parcel.writeString(telphone)
        parcel.writeValue(userid)
        parcel.writeValue(userinfotype)
        parcel.writeInt(indexSelect)
    }

    override fun describeContents(): Int {
        return 0
    }

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

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