import Foundation

/// Device new login packet (0x09) — server notifies all devices when a new device logs in.
/// Field order matches TypeScript: ipAddress, deviceId, deviceName, deviceOs.
struct PacketDeviceNew: Packet {
    static let packetId = 0x09

    var ipAddress: String = ""
    var deviceId: String = ""
    var deviceName: String = ""
    var deviceOs: String = ""

    func write(to stream: Stream) {
        stream.writeString(ipAddress)
        stream.writeString(deviceId)
        stream.writeString(deviceName)
        stream.writeString(deviceOs)
    }

    mutating func read(from stream: Stream) {
        ipAddress = stream.readString()
        deviceId = stream.readString()
        deviceName = stream.readString()
        deviceOs = stream.readString()
    }
}
