class HoseItem {
  final int talkgroupId;
  final String talkgroupName;
  final String sourceCall;
  final String? sourceName;
  final int slot;
  final DateTime lastActivity;
  final bool isActive;

  HoseItem({
    required this.talkgroupId,
    required this.talkgroupName,
    required this.sourceCall,
    this.sourceName,
    required this.slot,
    required this.lastActivity,
    required this.isActive,
  });

  String get displayName {
    if (sourceName != null && sourceName!.isNotEmpty) {
      return '$sourceCall ($sourceName)';
    }
    return sourceCall;
  }

  HoseItem copyWith({
    int? talkgroupId,
    String? talkgroupName,
    String? sourceCall,
    String? sourceName,
    int? slot,
    DateTime? lastActivity,
    bool? isActive,
  }) {
    return HoseItem(
      talkgroupId: talkgroupId ?? this.talkgroupId,
      talkgroupName: talkgroupName ?? this.talkgroupName,
      sourceCall: sourceCall ?? this.sourceCall,
      sourceName: sourceName ?? this.sourceName,
      slot: slot ?? this.slot,
      lastActivity: lastActivity ?? this.lastActivity,
      isActive: isActive ?? this.isActive,
    );
  }
}
