Files
oott/frontend/lib/model/device.dart
T
rzuastiandClaude Sonnet 4.6 1b470fc28f Extract DeviceType as an enum with icon and label getters
Mirrors the NotificationType pattern. Removes duplicated _deviceTypes
list and _deviceIcon() helper from both device screens, centralising
all type-to-icon logic in the model.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-27 19:06:09 -04:00

31 lines
865 B
Dart

import 'device_type.dart';
class Device {
final String macAddress;
final String ipv4Address;
final String vendor;
final DateTime lastSeen;
final bool isRegistered;
final String owner;
final DeviceType deviceType;
Device({
required this.macAddress,
required this.ipv4Address,
required this.vendor,
required this.lastSeen,
required this.isRegistered,
required this.owner,
required this.deviceType,
});
Device.fromJson(Map<String, dynamic> json)
: macAddress = json['mac_address'] as String,
ipv4Address = json['ipv4_address'] as String,
vendor = json['vendor'] as String,
lastSeen = DateTime.parse(json['last_seen'] as String),
isRegistered = json['is_registered'] as bool,
owner = json['owner'] as String,
deviceType = DeviceType.fromString(json['device_type'] as String);
}