class AdbDevice {
  const AdbDevice({
    required this.serial,
    required this.state,
    this.model,
    this.product,
    this.device,
  });

  final String serial;
  final String state;
  final String? model;
  final String? product;
  final String? device;

  bool get isReady => state == 'device';
  bool get needsAuthorization => state == 'unauthorized';
  bool get isOffline => state == 'offline';

  String get displayName {
    if (model != null && model!.isNotEmpty) {
      return model!.replaceAll('_', ' ');
    }

    if (device != null && device!.isNotEmpty) {
      return device!;
    }

    return serial;
  }
}
