package com.rosetta.messenger.network

data class DeviceInfo(
    var deviceId: String = "",
    var deviceName: String = "",
    var deviceOs: String = ""
)

class PacketDeviceNew : Packet() {
    var ipAddress: String = ""
    var device: DeviceInfo = DeviceInfo()

    override fun getPacketId(): Int = 0x09

    override fun receive(stream: Stream) {
        ipAddress = stream.readString()
        device = DeviceInfo(
            deviceId = stream.readString(),
            deviceName = stream.readString(),
            deviceOs = stream.readString()
        )
    }

    override fun send(): Stream {
        val stream = Stream()
        stream.writeInt16(getPacketId())
        stream.writeString(ipAddress)
        stream.writeString(device.deviceId)
        stream.writeString(device.deviceName)
        stream.writeString(device.deviceOs)
        return stream
    }
}
