package com.rosetta.messenger.network

class PacketGroupJoin : Packet() {
    var groupId: String = ""
    var groupStatus: GroupStatus = GroupStatus.NOT_JOINED
    var groupString: String = ""

    override fun getPacketId(): Int = 0x14

    override fun receive(stream: Stream) {
        groupId = stream.readString()
        groupStatus = GroupStatus.fromInt(stream.readInt8())
        groupString = stream.readString()
    }

    override fun send(): Stream {
        val stream = Stream()
        stream.writeInt16(getPacketId())
        stream.writeString(groupId)
        stream.writeInt8(groupStatus.value)
        stream.writeString(groupString)
        return stream
    }
}
