class StaticTalkgroup {
  final String? talkgroup;
  final String? repeaterId;
  final String? slot;
  final int? timeout;

  StaticTalkgroup({
    this.talkgroup,
    this.repeaterId,
    this.slot,
    this.timeout,
  });

  factory StaticTalkgroup.fromJson(Map<String, dynamic> json) {
    return StaticTalkgroup(
      talkgroup: json['talkgroup']?.toString(),
      repeaterId: json['repeaterId']?.toString(),
      slot: json['slot']?.toString(),
      timeout: json['timeout'] as int?,
    );
  }

  Map<String, dynamic> toJson() {
    return {
      'talkgroup': talkgroup,
      'repeaterId': repeaterId,
      'slot': slot,
      'timeout': timeout,
    };
  }

  String get displaySlot {
    return slot != null ? 'TS$slot' : 'TS?';
  }

  String get displayId {
    return talkgroup ?? 'Unknown';
  }
}
