package com.rosetta.messenger.network

/**
 * Read packet (ID: 0x07)
 * Уведомление о прочтении сообщения
 * Порядок полей как в Desktop: privateKey, fromPublicKey, toPublicKey
 */
class PacketRead : Packet() {
    var privateKey: String = ""
    var fromPublicKey: String = ""
    var toPublicKey: String = ""

    override fun getPacketId(): Int = 0x07

    override fun receive(stream: Stream) {
        // Desktop: privateKey, fromPublicKey, toPublicKey
        privateKey = stream.readString()
        fromPublicKey = stream.readString()
        toPublicKey = stream.readString()
    }

    override fun send(): Stream {
        val stream = Stream()
        stream.writeInt16(getPacketId())
        // Desktop: privateKey, fromPublicKey, toPublicKey
        stream.writeString(privateKey)
        stream.writeString(fromPublicKey)
        stream.writeString(toPublicKey)
        return stream
    }
}
