KonectarApp/lib/model/eventspeakers.dart

331 lines
9.1 KiB
Dart
Raw Permalink Normal View History

2024-11-19 12:57:30 +00:00
// 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<SpeakersList>? data;
int? lastPage;
int? lastRow;
int? count;
SpeakersResponse({
this.code,
this.message,
this.data,
this.lastPage,
this.lastRow,
this.count,
});
factory SpeakersResponse.fromJson(Map<String, dynamic> json) =>
SpeakersResponse(
code: json["code"],
message: json["message"],
data: json["data"] == null
? []
: List<SpeakersList>.from(
json["data"]!.map((x) => SpeakersList.fromJson(x))),
lastPage: json["last_page"],
lastRow: json["last_row"],
count: json["count"],
);
Map<String, dynamic> toJson() => {
"code": code,
"message": message,
"data": data == null
? []
: List<dynamic>.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<String, dynamic> json) =>
SpeakersResponse1(
data: json["data"] == null ? null : Data1.fromJson(json["data"]),
);
Map<String, dynamic> toJson() => {
"data": data?.toJson(),
};
}
class Data1 {
List<SpeakersList>? data;
Data1({
this.data,
});
factory Data1.fromJson(Map<String, dynamic> json) => Data1(
data: json["data"] == null
? []
: List<SpeakersList>.from(
json["data"]!.map((x) => SpeakersList.fromJson(x))),
);
Map<String, dynamic> toJson() => {
"data": data == null
? []
: List<dynamic>.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<String>? sessionNames;
@HiveField(19)
List<String>? 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<String, dynamic> 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<String, dynamic> 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<String>.from(json["session_names"]!.map((x) => x)),
topics: json["topics"] == null
? []
: List<String>.from(json["topics"]!.map((x) => x)),
);
Map<String, dynamic> 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<dynamic>.from(sessionNames!.map((x) => x)),
"topics":
topics == null ? [] : List<dynamic>.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<T> {
Map<String, T> map;
late Map<T, String> reverseMap;
EnumValues(this.map);
Map<T, String> get reverse {
reverseMap = map.map((k, v) => MapEntry(v, k));
return reverseMap;
}
}