// Author: fengshengxiong // Date: 2024/7/28 // Description: 搜索建议模型 import 'dart:convert'; class SearchSuggestionsModel { ResponseContext? responseContext; List? contents; String? trackingParams; SearchSuggestionsModel({ this.responseContext, this.contents, this.trackingParams, }); factory SearchSuggestionsModel.fromJson(String str) => SearchSuggestionsModel.fromMap(json.decode(str)); String toJson() => json.encode(toMap()); factory SearchSuggestionsModel.fromMap(Map json) => SearchSuggestionsModel( responseContext: json["responseContext"] == null ? null : ResponseContext.fromMap(json["responseContext"]), contents: json["contents"] == null ? [] : List.from(json["contents"]!.map((x) => SearchSuggestionsModelContent.fromMap(x))), trackingParams: json["trackingParams"], ); Map toMap() => { "responseContext": responseContext?.toMap(), "contents": contents == null ? [] : List.from(contents!.map((x) => x.toMap())), "trackingParams": trackingParams, }; } class SearchSuggestionsModelContent { SearchSuggestionsSectionRenderer? searchSuggestionsSectionRenderer; SearchSuggestionsModelContent({ this.searchSuggestionsSectionRenderer, }); factory SearchSuggestionsModelContent.fromJson(String str) => SearchSuggestionsModelContent.fromMap(json.decode(str)); String toJson() => json.encode(toMap()); factory SearchSuggestionsModelContent.fromMap(Map json) => SearchSuggestionsModelContent( searchSuggestionsSectionRenderer: json["searchSuggestionsSectionRenderer"] == null ? null : SearchSuggestionsSectionRenderer.fromMap(json["searchSuggestionsSectionRenderer"]), ); Map toMap() => { "searchSuggestionsSectionRenderer": searchSuggestionsSectionRenderer?.toMap(), }; } class SearchSuggestionsSectionRenderer { List? contents; SearchSuggestionsSectionRenderer({ this.contents, }); factory SearchSuggestionsSectionRenderer.fromJson(String str) => SearchSuggestionsSectionRenderer.fromMap(json.decode(str)); String toJson() => json.encode(toMap()); factory SearchSuggestionsSectionRenderer.fromMap(Map json) => SearchSuggestionsSectionRenderer( contents: json["contents"] == null ? [] : List.from(json["contents"]!.map((x) => SearchSuggestionsSectionRendererContent.fromMap(x))), ); Map toMap() => { "contents": contents == null ? [] : List.from(contents!.map((x) => x.toMap())), }; } class SearchSuggestionsSectionRendererContent { SearchSuggestionRenderer? searchSuggestionRenderer; SearchSuggestionsSectionRendererContent({ this.searchSuggestionRenderer, }); factory SearchSuggestionsSectionRendererContent.fromJson(String str) => SearchSuggestionsSectionRendererContent.fromMap(json.decode(str)); String toJson() => json.encode(toMap()); factory SearchSuggestionsSectionRendererContent.fromMap(Map json) => SearchSuggestionsSectionRendererContent( searchSuggestionRenderer: json["searchSuggestionRenderer"] == null ? null : SearchSuggestionRenderer.fromMap(json["searchSuggestionRenderer"]), ); Map toMap() => { "searchSuggestionRenderer": searchSuggestionRenderer?.toMap(), }; } class SearchSuggestionRenderer { Suggestion? suggestion; NavigationEndpoint? navigationEndpoint; String? trackingParams; Icon? icon; SearchSuggestionRenderer({ this.suggestion, this.navigationEndpoint, this.trackingParams, this.icon, }); factory SearchSuggestionRenderer.fromJson(String str) => SearchSuggestionRenderer.fromMap(json.decode(str)); String toJson() => json.encode(toMap()); factory SearchSuggestionRenderer.fromMap(Map json) => SearchSuggestionRenderer( suggestion: json["suggestion"] == null ? null : Suggestion.fromMap(json["suggestion"]), navigationEndpoint: json["navigationEndpoint"] == null ? null : NavigationEndpoint.fromMap(json["navigationEndpoint"]), trackingParams: json["trackingParams"], icon: json["icon"] == null ? null : Icon.fromMap(json["icon"]), ); Map toMap() => { "suggestion": suggestion?.toMap(), "navigationEndpoint": navigationEndpoint?.toMap(), "trackingParams": trackingParams, "icon": icon?.toMap(), }; } class Icon { String? iconType; Icon({ this.iconType, }); factory Icon.fromJson(String str) => Icon.fromMap(json.decode(str)); String toJson() => json.encode(toMap()); factory Icon.fromMap(Map json) => Icon( iconType: json["iconType"], ); Map toMap() => { "iconType": iconType, }; } class NavigationEndpoint { String? clickTrackingParams; SearchEndpoint? searchEndpoint; NavigationEndpoint({ this.clickTrackingParams, this.searchEndpoint, }); factory NavigationEndpoint.fromJson(String str) => NavigationEndpoint.fromMap(json.decode(str)); String toJson() => json.encode(toMap()); factory NavigationEndpoint.fromMap(Map json) => NavigationEndpoint( clickTrackingParams: json["clickTrackingParams"], searchEndpoint: json["searchEndpoint"] == null ? null : SearchEndpoint.fromMap(json["searchEndpoint"]), ); Map toMap() => { "clickTrackingParams": clickTrackingParams, "searchEndpoint": searchEndpoint?.toMap(), }; } class SearchEndpoint { String? query; SearchEndpoint({ this.query, }); factory SearchEndpoint.fromJson(String str) => SearchEndpoint.fromMap(json.decode(str)); String toJson() => json.encode(toMap()); factory SearchEndpoint.fromMap(Map json) => SearchEndpoint( query: json["query"], ); Map toMap() => { "query": query, }; } class Suggestion { List? runs; Suggestion({ this.runs, }); factory Suggestion.fromJson(String str) => Suggestion.fromMap(json.decode(str)); String toJson() => json.encode(toMap()); factory Suggestion.fromMap(Map json) => Suggestion( runs: json["runs"] == null ? [] : List.from(json["runs"]!.map((x) => Run.fromMap(x))), ); Map toMap() => { "runs": runs == null ? [] : List.from(runs!.map((x) => x.toMap())), }; } class Run { String? text; bool? bold; Run({ this.text, this.bold, }); factory Run.fromJson(String str) => Run.fromMap(json.decode(str)); String toJson() => json.encode(toMap()); factory Run.fromMap(Map json) => Run( text: json["text"], bold: json["bold"], ); Map toMap() => { "text": text, "bold": bold, }; } class ResponseContext { String? visitorData; List? serviceTrackingParams; ResponseContext({ this.visitorData, this.serviceTrackingParams, }); factory ResponseContext.fromJson(String str) => ResponseContext.fromMap(json.decode(str)); String toJson() => json.encode(toMap()); factory ResponseContext.fromMap(Map json) => ResponseContext( visitorData: json["visitorData"], serviceTrackingParams: json["serviceTrackingParams"] == null ? [] : List.from(json["serviceTrackingParams"]!.map((x) => ServiceTrackingParam.fromMap(x))), ); Map toMap() => { "visitorData": visitorData, "serviceTrackingParams": serviceTrackingParams == null ? [] : List.from(serviceTrackingParams!.map((x) => x.toMap())), }; } class ServiceTrackingParam { String? service; List? params; ServiceTrackingParam({ this.service, this.params, }); factory ServiceTrackingParam.fromJson(String str) => ServiceTrackingParam.fromMap(json.decode(str)); String toJson() => json.encode(toMap()); factory ServiceTrackingParam.fromMap(Map json) => ServiceTrackingParam( service: json["service"], params: json["params"] == null ? [] : List.from(json["params"]!.map((x) => Param.fromMap(x))), ); Map toMap() => { "service": service, "params": params == null ? [] : List.from(params!.map((x) => x.toMap())), }; } class Param { String? key; String? value; Param({ this.key, this.value, }); factory Param.fromJson(String str) => Param.fromMap(json.decode(str)); String toJson() => json.encode(toMap()); factory Param.fromMap(Map json) => Param( key: json["key"], value: json["value"], ); Map toMap() => { "key": key, "value": value, }; }