Files
oott/frontend/lib/model/device_event.dart
T
rzuastiandClaude Opus 4.7 55a6b29d1c Show scanner source in device event tooltip
Surface the originating scanner ("ARP" or "mDNS") in the event timeline
tooltip so users can tell which scanner reported each sighting.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-06-01 08:19:49 -04:00

38 lines
948 B
Dart

class DeviceEvent {
final int id;
final String macAddress;
final DateTime createdOn;
final String eventType;
final String ipv4Address;
final String vendor;
final String scanner;
const DeviceEvent({
required this.id,
required this.macAddress,
required this.createdOn,
required this.eventType,
required this.ipv4Address,
required this.vendor,
required this.scanner,
});
factory DeviceEvent.fromJson(Map<String, dynamic> json) {
return DeviceEvent(
id: json['id'] as int,
macAddress: json['mac_address'] as String,
createdOn: DateTime.parse(json['created_on'] as String),
eventType: json['event_type'] as String,
ipv4Address: json['ipv4_address'] as String,
vendor: json['vendor'] as String,
scanner: json['scanner'] as String,
);
}
String get scannerLabel => switch (scanner) {
'Arp' => 'ARP',
'Mdns' => 'mDNS',
_ => scanner,
};
}