// To parse this JSON data, do // // final speakersResponse = speakersResponseFromJson(jsonString); import 'dart:convert'; import 'package:hive_flutter/hive_flutter.dart'; import 'package:konectar_events/contacts_module/model_class/speaker.dart'; part 'eventspeakers.g.dart'; SpeakersResponse speakersResponseFromJson(String str) => SpeakersResponse.fromJson(json.decode(str)); String speakersResponseToJson(SpeakersResponse data) => json.encode(data.toJson()); class SpeakersResponse { int? code; String? message; List? data; int? lastPage; int? lastRow; int? count; SpeakersResponse({ this.code, this.message, this.data, this.lastPage, this.lastRow, this.count, }); factory SpeakersResponse.fromJson(Map json) => SpeakersResponse( code: json["code"], message: json["message"], data: json["data"] == null ? [] : List.from( json["data"]!.map((x) => SpeakersList.fromJson(x))), lastPage: json["last_page"], lastRow: json["last_row"], count: json["count"], ); Map toJson() => { "code": code, "message": message, "data": data == null ? [] : List.from(data!.map((x) => x.toJson())), "last_page": lastPage, "last_row": lastRow, "count": count, }; } class SpeakersResponse1 { Data1? data; SpeakersResponse1({ this.data, }); factory SpeakersResponse1.fromJson(Map json) => SpeakersResponse1( data: json["data"] == null ? null : Data1.fromJson(json["data"]), ); Map toJson() => { "data": data?.toJson(), }; } class Data1 { List? data; Data1({ this.data, }); factory Data1.fromJson(Map json) => Data1( data: json["data"] == null ? [] : List.from( json["data"]!.map((x) => SpeakersList.fromJson(x))), ); Map toJson() => { "data": data == null ? [] : List.from(data!.map((x) => x.toJson())), }; } @HiveType(typeId: 25) class SpeakersList { @HiveField(0) String? uniqueId; @HiveField(1) String? hcpFullName; @HiveField(2) String? hcpPin; @HiveField(3) int? npiNum; @HiveField(4) String? specialty; @HiveField(5) String? organization; @HiveField(6) String? therapeuticArea; @HiveField(7) dynamic cleansStatus; @HiveField(8) int? isDeleted; @HiveField(9) CreatedByUser? createdByUser; @HiveField(10) CreatedByUser? updatedByUser; @HiveField(11) String? cityName; @HiveField(12) String? stateName; @HiveField(13) String? countryName; @HiveField(14) dynamic deletedByUser; @HiveField(15) DateTime? formattedCreatedAt; @HiveField(16) DateTime? formattedUpdatedAt; @HiveField(17) dynamic formattedDeletedAt; @HiveField(18) List? sessionNames; @HiveField(19) List? topics; SpeakersList({ this.uniqueId, this.hcpFullName, this.hcpPin, this.npiNum, this.specialty, this.organization, this.therapeuticArea, this.cleansStatus, this.isDeleted, this.createdByUser, this.updatedByUser, this.cityName, this.stateName, this.countryName, this.deletedByUser, this.formattedCreatedAt, this.formattedUpdatedAt, this.formattedDeletedAt, this.sessionNames, this.topics, }); // SpeakersList.fromJson(Map json) { // if (json["unique_id"] is String) { // city = json["city_name"] ?? null; // } // if (json["country_name"] is String) { // country = json["country_name"] ?? null; // } // if (json["state_name"] is String) { // region = json["state_name"] ?? null; // } // if (json["activity_type"] is String) { // activityType = json["activity_type"]; // } // if (json["address"] is String) { // address = json["address"]; // } // if (json["city_id"] is String) { // cityId = json["city_id"]; // } // if (json["client_id"] is String) { // clientId = json["client_id"]; // } // if (json["cnt"] is String) { // cnt = json["cnt"]; // } // if (json["country_id"] is String) { // countryId = json["country_id"]; // } // if (json["created_by"] is String) { // createdBy = json["created_by"]; // } // if (json["created_on"] is String) { // createdOn = json["created_on"]; // } // if (json["dAllowed"] is bool) { // dAllowed = json["dAllowed"]; // } // if (json["eAllowed"] is bool) { // eAllowed = json["eAllowed"]; // } // if (json["end_date"] is String) { // end = json["end_date"]; // } // if (json["eventLat"] is String) { // eventLat = json["eventLat"]; // } // if (json["eventLong"] is String) { // eventLong = json["eventLong"]; // } // if (json["unique_id"] is String) { // eventId = json["unique_id"]; // } // if (json["event_type_name"] is String) { // eventType = json["event_type_name"]; // } // if (json["event_unique_id"] is String) { // eventUniqueId = json["event_unique_id"]; // } // if (json["event_user_attendee"] is bool) { // eventUserAttendee = json["event_user_attendee"]; // } // if (json["global_event_id"] is String) { // globalEventId = json["global_event_id"]; // } // if (json["hcp_pin"] is String) { // hcpPin = json["hcp_pin"]; // } // if (json["id"] is String) { // id = json["id"]; // } // if (json["kol_id"] is String) { // kolId = json["kol_id"]; // } // if (json["location"] is String) { // location = json["location"]; // } // if (json["modified_by"] is String) { // modifiedBy = json["modified_by"]; // } // if (json["modified_on"] is String) { // modifiedOn = json["modified_on"]; // } // if (json["event_name"] is String) { // name1 = json["event_name"]; // } // } factory SpeakersList.fromJson(Map json) => SpeakersList( uniqueId: json["unique_id"], hcpFullName: json["hcp_full_name"] ?? null, hcpPin: json["hcp_pin"] ?? null, npiNum: json["npi_num"] ?? null, specialty: json["specialty"] ?? null, organization: json["organization"] ?? null, therapeuticArea: json["therapeutic_area"] ?? null, cleansStatus: json["cleans_status"] ?? null, isDeleted: json["is_deleted"] ?? null, createdByUser: CreatedByUserValues.map[json["created_by_user"]] ?? null, updatedByUser: CreatedByUserValues.map[json["updated_by_user"]] ?? null, cityName: json["city_name"] ?? null, stateName: json["state_name"] ?? null, countryName: json["country_name"] ?? null, deletedByUser: json["deleted_by_user"], formattedCreatedAt: json["formatted_created_at"] == null ? null : DateTime.parse(json["formatted_created_at"]), formattedUpdatedAt: json["formatted_updated_at"] == null ? null : DateTime.parse(json["formatted_updated_at"]), formattedDeletedAt: json["formatted_deleted_at"], sessionNames: json["session_names"] == null ? [] : List.from(json["session_names"]!.map((x) => x)), topics: json["topics"] == null ? [] : List.from(json["topics"]!.map((x) => x)), ); Map toJson() => { "unique_id": uniqueId, "hcp_full_name": hcpFullName, "hcp_pin": hcpPin, "npi_num": npiNum, "specialty": specialty, "organization": organization, "therapeutic_area": therapeuticAreaValues.reverse[therapeuticArea], "cleans_status": cleansStatus, "is_deleted": isDeleted, "created_by_user": CreatedByUserValues.reverse[createdByUser], "updated_by_user": CreatedByUserValues.reverse[updatedByUser], "city_name": cityName, "state_name": stateName, "country_name": countryName, "deleted_by_user": deletedByUser, "formatted_created_at": formattedCreatedAt?.toIso8601String(), "formatted_updated_at": formattedUpdatedAt?.toIso8601String(), "formatted_deleted_at": formattedDeletedAt, "session_names": sessionNames == null ? [] : List.from(sessionNames!.map((x) => x)), "topics": topics == null ? [] : List.from(topics!.map((x) => x)), }; } enum CreatedByUser { ADMIN_SUPER_ROOT } final CreatedByUserValues = EnumValues({"admin super root": CreatedByUser.ADMIN_SUPER_ROOT}); enum TherapeuticArea { ONCOLOGY_WOMENS_HEALTH } final therapeuticAreaValues = EnumValues( {"Oncology | Womens Health": TherapeuticArea.ONCOLOGY_WOMENS_HEALTH}); class EnumValues { Map map; late Map reverseMap; EnumValues(this.map); Map get reverse { reverseMap = map.map((k, v) => MapEntry(v, k)); return reverseMap; } }