class QueueInfo { final int id; final String name; final String type; final String? extension; final int waitingCount; QueueInfo({ required this.id, required this.name, required this.type, this.extension, required this.waitingCount, }); factory QueueInfo.fromJson(Map json) { return QueueInfo( id: _toInt(json['id']), name: (json['name'] ?? '') as String, type: (json['type'] ?? '') as String, extension: json['extension'] as String?, waitingCount: _toInt(json['waiting_count']), ); } static int _toInt(dynamic value) { if (value is int) return value; if (value is String) return int.tryParse(value) ?? 0; return 0; } } class QueueCall { final String callSid; final String fromNumber; final String toNumber; final int position; final String status; final int waitTime; QueueCall({ required this.callSid, required this.fromNumber, required this.toNumber, required this.position, required this.status, required this.waitTime, }); factory QueueCall.fromJson(Map json) { return QueueCall( callSid: (json['call_sid'] ?? '') as String, fromNumber: (json['from_number'] ?? '') as String, toNumber: (json['to_number'] ?? '') as String, position: _toInt(json['position']), status: (json['status'] ?? '') as String, waitTime: _toInt(json['wait_time']), ); } static int _toInt(dynamic value) { if (value is int) return value; if (value is String) return int.tryParse(value) ?? 0; return 0; } }