package com.kaixed.kchat.model.search

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

/**
 * @Author: kaixed
 * @Date: 2024/9/22 22:58
 * @Description: 用户详细资料实体类
 */
data class User(
    val username: String,
    val nickname: String,
    val signature: String,
    val avatarUrl: String,
    val status: String?,
) : Parcelable {
    constructor(parcel: Parcel) : this(
        parcel.readString() ?: "",
        parcel.readString() ?: "",
        parcel.readString() ?: "",
        parcel.readString() ?: "",
        parcel.readString()
    )

    override fun writeToParcel(parcel: Parcel, flags: Int) {
        parcel.writeString(username)
        parcel.writeString(nickname)
        parcel.writeString(signature)
        parcel.writeString(avatarUrl)
        parcel.writeString(status)
    }

    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)
        }
    }
}