package com.rosetta.messenger.network

class PacketGroupInviteInfo : Packet() {
    var groupId: String = ""
    var membersCount: Int = 0
    var groupStatus: GroupStatus = GroupStatus.NOT_JOINED

    override fun getPacketId(): Int = 0x13

    override fun receive(stream: Stream) {
        groupId = stream.readString()
        membersCount = stream.readInt16().coerceAtLeast(0)
        groupStatus = GroupStatus.fromInt(stream.readInt8())
    }

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