// device_usage.dart — 单设备窗口用量(GET /v1/usage/devices?days=N 的一条)。 // 统计页「下分设备」明细的数据载体,与账户聚合的 UsagePoint 对应。 class DeviceUsage { const DeviceUsage({ required this.uuid, required this.name, required this.platform, this.bytesUp = 0, this.bytesDown = 0, this.minutesUsed = 0, }); final String uuid; final String name; /// ios | android | windows | macos。 final String platform; final int bytesUp; final int bytesDown; final int minutesUsed; int get bytesTotal => bytesUp + bytesDown; double get gbTotal => bytesTotal / (1024 * 1024 * 1024); factory DeviceUsage.fromJson(Map m) => DeviceUsage( uuid: m['uuid'] as String? ?? '', name: m['name'] as String? ?? '', platform: m['platform'] as String? ?? '', bytesUp: (m['bytes_up'] as num?)?.toInt() ?? 0, bytesDown: (m['bytes_down'] as num?)?.toInt() ?? 0, minutesUsed: (m['minutes_used'] as num?)?.toInt() ?? 0, ); }