package com.kaixed.kchat.model.friend

import android.os.Parcel
import android.os.Parcelable
import kotlinx.serialization.Serializable

/**
 * @Author: kaixed
 * @Date: 2024/10/18 15:11
 */
@Serializable
data class FriendRequestItem(
    val nickname: String,
    val username: String,
    val message: String,
    val status: String,
    val signature: String,
    val requestTime: String,
    val avatarUrl: String,
) : Parcelable {
    constructor(parcel: Parcel) : this(
        parcel.readString() ?: "",
        parcel.readString() ?: "",
        parcel.readString() ?: "",
        parcel.readString() ?: "",
        parcel.readString() ?: "",
        parcel.readString() ?: "",
        parcel.readString() ?: ""
    ) {
    }

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

    override fun describeContents(): Int {
        return 0
    }

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

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