package com.seasonyuu.simplewechat.bean;

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

/**
 * Created by seasonyuu on 15/7/9.
 */
public class ChatInfo implements Parcelable {
    public FriendInfo friendInfo;
    public MessageInfo lastMessageInfo;

    public ChatInfo(FriendInfo friendInfo, MessageInfo lastMessageInfo) {
        this.friendInfo = friendInfo;
        this.lastMessageInfo = lastMessageInfo;
    }

    protected ChatInfo(Parcel in) {
        friendInfo = new FriendInfo();
        friendInfo.age = in.readString();
        friendInfo.email = in.readString();
        friendInfo.introduction = in.readString();
        friendInfo.nickName = in.readString();
        friendInfo.remark = in.readString();
        friendInfo.sex = in.readString();
        friendInfo.userid = in.readString();
        lastMessageInfo = new MessageInfo();
        lastMessageInfo.content = in.readString();
        lastMessageInfo.fromId = in.readString();
        lastMessageInfo.messageId = in.readString();
        lastMessageInfo.time = in.readString();
        lastMessageInfo.toId = in.readString();
    }

    public static final Creator<ChatInfo> CREATOR = new Creator<ChatInfo>() {
        @Override
        public ChatInfo createFromParcel(Parcel in) {
            return new ChatInfo(in);
        }

        @Override
        public ChatInfo[] newArray(int size) {
            return new ChatInfo[size];
        }
    };

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(friendInfo.age);
        dest.writeString(friendInfo.email);
        dest.writeString(friendInfo.introduction);
        dest.writeString(friendInfo.nickName);
        dest.writeString(friendInfo.remark);
        dest.writeString(friendInfo.sex);
        dest.writeString(friendInfo.userid);
        dest.writeString(lastMessageInfo.content);
        dest.writeString(lastMessageInfo.fromId);
        dest.writeString(lastMessageInfo.messageId);
        dest.writeString(lastMessageInfo.time);
        dest.writeString(lastMessageInfo.toId);
    }

}
