package com.rosetta.messenger.network

/**
 * Delivery packet (ID: 0x08)
 * Уведомление о доставке сообщения
 * Порядок полей как в React Native: toPublicKey, messageId
 */
class PacketDelivery : Packet() {
    var messageId: String = ""
    var toPublicKey: String = ""

    override fun getPacketId(): Int = 0x08

    override fun receive(stream: Stream) {
        // React Native читает: toPublicKey, messageId
        toPublicKey = stream.readString()
        messageId = stream.readString()
    }

    override fun send(): Stream {
        val stream = Stream()
        stream.writeInt16(getPacketId())
        // React Native пишет: toPublicKey, messageId
        stream.writeString(toPublicKey)
        stream.writeString(messageId)
        return stream
    }
}
