forked from eatvio/eatvio_app
1903 lines
63 KiB
Dart
1903 lines
63 KiB
Dart
sealed class BaseNotificationModel {
|
|
abstract final NotificationType type;
|
|
abstract final bool isRead;
|
|
abstract final DateTime createdAt;
|
|
}
|
|
|
|
class PlanSubscriptionStartedToAuthorNotification implements BaseNotificationModel {
|
|
@override
|
|
final NotificationType type;
|
|
@override
|
|
final bool isRead;
|
|
final String planName;
|
|
final String customerName;
|
|
final String chatId;
|
|
@override
|
|
final DateTime createdAt;
|
|
|
|
PlanSubscriptionStartedToAuthorNotification({
|
|
required this.type,
|
|
required this.planName,
|
|
required this.customerName,
|
|
required this.chatId,
|
|
required this.isRead,
|
|
required this.createdAt,
|
|
});
|
|
|
|
factory PlanSubscriptionStartedToAuthorNotification.fromJson(Map<String, dynamic> json, NotificationType type, {bool? isRead, String? createdAt}) {
|
|
return PlanSubscriptionStartedToAuthorNotification(
|
|
type: type,
|
|
planName: json['plan_name'],
|
|
customerName: json['user_name'],
|
|
chatId: json['chat_id'],
|
|
isRead: isRead ?? false,
|
|
createdAt: parseDate(createdAt ?? json['created_at'] ?? DateTime.now().toIso8601String()),
|
|
);
|
|
}
|
|
}
|
|
|
|
class PlanSubscriptionCanceledToAuthorNotification implements BaseNotificationModel {
|
|
@override
|
|
final NotificationType type;
|
|
@override
|
|
final bool isRead;
|
|
final String planName;
|
|
final String customerName;
|
|
@override
|
|
final DateTime createdAt;
|
|
|
|
PlanSubscriptionCanceledToAuthorNotification({
|
|
required this.type,
|
|
required this.planName,
|
|
required this.customerName,
|
|
required this.isRead,
|
|
required this.createdAt,
|
|
});
|
|
|
|
factory PlanSubscriptionCanceledToAuthorNotification.fromJson(Map<String, dynamic> json, NotificationType type, {bool? isRead, String? createdAt}) {
|
|
return PlanSubscriptionCanceledToAuthorNotification(
|
|
type: type,
|
|
planName: json['plan_name'],
|
|
customerName: json['user_name'],
|
|
isRead: isRead ?? false,
|
|
createdAt: parseDate(createdAt ?? json['created_at'] ?? DateTime.now().toIso8601String()),
|
|
);
|
|
}
|
|
}
|
|
|
|
class ChosenPlanStartedToClientNotification implements BaseNotificationModel {
|
|
@override
|
|
final NotificationType type;
|
|
@override
|
|
final bool isRead;
|
|
final String planName;
|
|
final int planId;
|
|
@override
|
|
final DateTime createdAt;
|
|
|
|
ChosenPlanStartedToClientNotification({required this.type, required this.planName, required this.planId, required this.isRead, required this.createdAt});
|
|
|
|
factory ChosenPlanStartedToClientNotification.fromJson(Map<String, dynamic> json, NotificationType type, {bool? isRead, String? createdAt}) {
|
|
return ChosenPlanStartedToClientNotification(
|
|
type: type,
|
|
planName: json['plan_name'],
|
|
planId: json['plan_id'],
|
|
isRead: isRead ?? false,
|
|
createdAt: parseDate(createdAt ?? json['created_at'] ?? DateTime.now().toIso8601String()),
|
|
);
|
|
}
|
|
}
|
|
|
|
class ChosenPlanTomorrowReminderToClientNotification implements BaseNotificationModel {
|
|
@override
|
|
final NotificationType type;
|
|
@override
|
|
final bool isRead;
|
|
final String planName;
|
|
@override
|
|
final DateTime createdAt;
|
|
|
|
ChosenPlanTomorrowReminderToClientNotification({required this.type, required this.planName, required this.isRead, required this.createdAt});
|
|
|
|
factory ChosenPlanTomorrowReminderToClientNotification.fromJson(Map<String, dynamic> json, NotificationType type, {bool? isRead, String? createdAt}) {
|
|
return ChosenPlanTomorrowReminderToClientNotification(
|
|
type: type,
|
|
planName: json['plan_name'],
|
|
isRead: isRead ?? false,
|
|
createdAt: parseDate(createdAt ?? json['created_at'] ?? DateTime.now().toIso8601String()),
|
|
);
|
|
}
|
|
}
|
|
|
|
class DiaryReminderNotification implements BaseNotificationModel {
|
|
@override
|
|
final NotificationType type;
|
|
@override
|
|
final bool isRead;
|
|
@override
|
|
final DateTime createdAt;
|
|
|
|
DiaryReminderNotification({required this.type, required this.isRead, required this.createdAt});
|
|
|
|
factory DiaryReminderNotification.fromJson(Map<String, dynamic> json, NotificationType type, {bool? isRead, String? createdAt}) {
|
|
return DiaryReminderNotification(
|
|
type: type,
|
|
isRead: isRead ?? false,
|
|
createdAt: parseDate(createdAt ?? json['created_at'] ?? DateTime.now().toIso8601String()),
|
|
);
|
|
}
|
|
}
|
|
|
|
class ConsultantLeftCommentNotification implements BaseNotificationModel {
|
|
@override
|
|
final NotificationType type;
|
|
@override
|
|
final bool isRead;
|
|
final DateTime date;
|
|
@override
|
|
final DateTime createdAt;
|
|
|
|
ConsultantLeftCommentNotification({required this.type, required this.date, required this.isRead, required this.createdAt});
|
|
|
|
factory ConsultantLeftCommentNotification.fromJson(Map<String, dynamic> json, NotificationType type, {bool? isRead, String? createdAt}) {
|
|
return ConsultantLeftCommentNotification(
|
|
type: type,
|
|
date: parseDate(json['diary_date'] ?? DateTime.now().toIso8601String()),
|
|
isRead: isRead ?? false,
|
|
createdAt: parseDate(createdAt ?? json['created_at'] ?? DateTime.now().toIso8601String()),
|
|
);
|
|
}
|
|
}
|
|
|
|
class PersonalizedDietIsDefinedNotification implements BaseNotificationModel {
|
|
@override
|
|
final NotificationType type;
|
|
@override
|
|
final bool isRead;
|
|
@override
|
|
final DateTime createdAt;
|
|
|
|
PersonalizedDietIsDefinedNotification({required this.type, required this.isRead, required this.createdAt});
|
|
|
|
factory PersonalizedDietIsDefinedNotification.fromJson(Map<String, dynamic> json, NotificationType type, {bool? isRead, String? createdAt}) {
|
|
return PersonalizedDietIsDefinedNotification(
|
|
type: type,
|
|
isRead: isRead ?? false,
|
|
createdAt: parseDate(createdAt ?? json['created_at'] ?? DateTime.now().toIso8601String()),
|
|
);
|
|
}
|
|
}
|
|
|
|
class ChosenPlanFinishedToClientNotification implements BaseNotificationModel {
|
|
@override
|
|
final NotificationType type;
|
|
@override
|
|
final bool isRead;
|
|
final String planName;
|
|
@override
|
|
final DateTime createdAt;
|
|
ChosenPlanFinishedToClientNotification({required this.type, required this.planName, required this.isRead, required this.createdAt});
|
|
|
|
factory ChosenPlanFinishedToClientNotification.fromJson(Map<String, dynamic> json, NotificationType type, {bool? isRead, String? createdAt}) {
|
|
return ChosenPlanFinishedToClientNotification(
|
|
type: type,
|
|
planName: json['plan_name'],
|
|
isRead: isRead ?? false,
|
|
createdAt: parseDate(createdAt ?? json['created_at'] ?? DateTime.now().toIso8601String()),
|
|
);
|
|
}
|
|
}
|
|
|
|
class PlanSubscriptionCanceledToCustomerNotification implements BaseNotificationModel {
|
|
@override
|
|
final NotificationType type;
|
|
@override
|
|
final bool isRead;
|
|
final String planName;
|
|
@override
|
|
final DateTime createdAt;
|
|
PlanSubscriptionCanceledToCustomerNotification({required this.type, required this.planName, required this.isRead, required this.createdAt});
|
|
|
|
factory PlanSubscriptionCanceledToCustomerNotification.fromJson(Map<String, dynamic> json, NotificationType type, {bool? isRead, String? createdAt}) {
|
|
return PlanSubscriptionCanceledToCustomerNotification(
|
|
type: type,
|
|
planName: json['plan_name'],
|
|
isRead: isRead ?? false,
|
|
createdAt: parseDate(createdAt ?? json['created_at'] ?? DateTime.now().toIso8601String()),
|
|
);
|
|
}
|
|
}
|
|
|
|
class ChosenPlanStartedToConsultantNotification implements BaseNotificationModel {
|
|
@override
|
|
final NotificationType type;
|
|
@override
|
|
final bool isRead;
|
|
final String planName;
|
|
final String customerName;
|
|
@override
|
|
final DateTime createdAt;
|
|
ChosenPlanStartedToConsultantNotification({
|
|
required this.type,
|
|
required this.isRead,
|
|
required this.planName,
|
|
required this.customerName,
|
|
required this.createdAt,
|
|
});
|
|
|
|
factory ChosenPlanStartedToConsultantNotification.fromJson(Map<String, dynamic> json, NotificationType type, {bool? isRead, String? createdAt}) {
|
|
return ChosenPlanStartedToConsultantNotification(
|
|
type: type,
|
|
isRead: isRead ?? false,
|
|
planName: json['plan_name'],
|
|
customerName: json['client_name'],
|
|
createdAt: parseDate(createdAt ?? json['created_at'] ?? DateTime.now().toIso8601String()),
|
|
);
|
|
}
|
|
}
|
|
|
|
class ChosenPlanTomorrowReminderToConsultantNotification implements BaseNotificationModel {
|
|
@override
|
|
final NotificationType type;
|
|
@override
|
|
final bool isRead;
|
|
final String planName;
|
|
final String customerName;
|
|
@override
|
|
final DateTime createdAt;
|
|
ChosenPlanTomorrowReminderToConsultantNotification({
|
|
required this.type,
|
|
required this.planName,
|
|
required this.customerName,
|
|
required this.isRead,
|
|
required this.createdAt,
|
|
});
|
|
|
|
factory ChosenPlanTomorrowReminderToConsultantNotification.fromJson(Map<String, dynamic> json, NotificationType type, {bool? isRead, String? createdAt}) {
|
|
return ChosenPlanTomorrowReminderToConsultantNotification(
|
|
type: type,
|
|
planName: json['plan_name'],
|
|
customerName: json['client_name'],
|
|
isRead: isRead ?? false,
|
|
createdAt: parseDate(createdAt ?? json['created_at'] ?? DateTime.now().toIso8601String()),
|
|
);
|
|
}
|
|
}
|
|
|
|
class PlanSubscriptionPaidToAuthorNotification implements BaseNotificationModel {
|
|
@override
|
|
final NotificationType type;
|
|
@override
|
|
final bool isRead;
|
|
final String planName;
|
|
final String customerName;
|
|
@override
|
|
final DateTime createdAt;
|
|
PlanSubscriptionPaidToAuthorNotification({
|
|
required this.type,
|
|
required this.isRead,
|
|
required this.planName,
|
|
required this.customerName,
|
|
required this.createdAt,
|
|
});
|
|
|
|
factory PlanSubscriptionPaidToAuthorNotification.fromJson(Map<String, dynamic> json, NotificationType type, {bool? isRead, String? createdAt}) {
|
|
return PlanSubscriptionPaidToAuthorNotification(
|
|
type: type,
|
|
isRead: isRead ?? false,
|
|
planName: json['plan_name'],
|
|
customerName: json['user_name'],
|
|
createdAt: parseDate(createdAt ?? json['created_at'] ?? DateTime.now().toIso8601String()),
|
|
);
|
|
}
|
|
}
|
|
|
|
class ChosenPlanFinishedToConsultantNotification implements BaseNotificationModel {
|
|
@override
|
|
final NotificationType type;
|
|
@override
|
|
final bool isRead;
|
|
final String planName;
|
|
final String customerName;
|
|
final int planId;
|
|
@override
|
|
final DateTime createdAt;
|
|
ChosenPlanFinishedToConsultantNotification({
|
|
required this.type,
|
|
required this.planName,
|
|
required this.customerName,
|
|
required this.planId,
|
|
required this.isRead,
|
|
required this.createdAt,
|
|
});
|
|
|
|
factory ChosenPlanFinishedToConsultantNotification.fromJson(Map<String, dynamic> json, NotificationType type, {bool? isRead, String? createdAt}) {
|
|
return ChosenPlanFinishedToConsultantNotification(
|
|
type: type,
|
|
planName: json['plan_name'],
|
|
customerName: json['client_name'],
|
|
planId: json['chosen_plan_id'],
|
|
isRead: isRead ?? false,
|
|
createdAt: parseDate(createdAt ?? json['created_at'] ?? DateTime.now().toIso8601String()),
|
|
);
|
|
}
|
|
}
|
|
|
|
class ChosenPlanLastDayFinishedForUser implements BaseNotificationModel {
|
|
@override
|
|
final NotificationType type;
|
|
@override
|
|
final bool isRead;
|
|
@override
|
|
final DateTime createdAt;
|
|
|
|
ChosenPlanLastDayFinishedForUser({required this.type, required this.isRead, required this.createdAt});
|
|
|
|
factory ChosenPlanLastDayFinishedForUser.fromJson(Map<String, dynamic> json, NotificationType type, {bool? isRead, String? createdAt}) {
|
|
return ChosenPlanLastDayFinishedForUser(
|
|
type: type,
|
|
isRead: isRead ?? false,
|
|
createdAt: parseDate(createdAt ?? json['created_at'] ?? DateTime.now().toIso8601String()),
|
|
);
|
|
}
|
|
}
|
|
|
|
class ChosenPlanConsultantLastDayStarted implements BaseNotificationModel {
|
|
@override
|
|
final NotificationType type;
|
|
@override
|
|
final bool isRead;
|
|
final String planName;
|
|
final int planId;
|
|
final String chatId;
|
|
final String chatUrl;
|
|
@override
|
|
final DateTime createdAt;
|
|
|
|
ChosenPlanConsultantLastDayStarted({
|
|
required this.type,
|
|
required this.planName,
|
|
required this.planId,
|
|
required this.chatId,
|
|
required this.chatUrl,
|
|
required this.isRead,
|
|
required this.createdAt,
|
|
});
|
|
|
|
factory ChosenPlanConsultantLastDayStarted.fromJson(Map<String, dynamic> json, NotificationType type, {bool? isRead, String? createdAt}) {
|
|
return ChosenPlanConsultantLastDayStarted(
|
|
type: type,
|
|
planName: json['plan_name'],
|
|
planId: json['plan_id'],
|
|
chatId: json['chat_id'],
|
|
chatUrl: json['chat_url'],
|
|
isRead: isRead ?? false,
|
|
createdAt: parseDate(createdAt ?? json['created_at'] ?? DateTime.now().toIso8601String()),
|
|
);
|
|
}
|
|
}
|
|
|
|
class ComplaintToModerationForUser implements BaseNotificationModel {
|
|
@override
|
|
final NotificationType type;
|
|
@override
|
|
final bool isRead;
|
|
final String message;
|
|
final int entityId;
|
|
final String entityType;
|
|
@override
|
|
final DateTime createdAt;
|
|
|
|
ComplaintToModerationForUser({
|
|
required this.type,
|
|
required this.message,
|
|
required this.entityId,
|
|
required this.entityType,
|
|
required this.isRead,
|
|
required this.createdAt,
|
|
});
|
|
|
|
factory ComplaintToModerationForUser.fromJson(Map<String, dynamic> json, NotificationType type, {bool? isRead, String? createdAt}) {
|
|
return ComplaintToModerationForUser(
|
|
type: type,
|
|
message: json['message'],
|
|
entityId: json['entity_id'],
|
|
entityType: json['entity_type'],
|
|
isRead: isRead ?? false,
|
|
createdAt: parseDate(createdAt ?? json['created_at'] ?? DateTime.now().toIso8601String()),
|
|
);
|
|
}
|
|
}
|
|
|
|
class CommentReplied implements BaseNotificationModel {
|
|
@override
|
|
final NotificationType type;
|
|
@override
|
|
final bool isRead;
|
|
final String entityName;
|
|
final int commentedEntityId;
|
|
final String commentedEntityType;
|
|
final String author;
|
|
final int authorId;
|
|
final int parentCommentId;
|
|
@override
|
|
final DateTime createdAt;
|
|
|
|
CommentReplied({
|
|
required this.type,
|
|
required this.entityName,
|
|
required this.commentedEntityId,
|
|
required this.commentedEntityType,
|
|
required this.author,
|
|
required this.authorId,
|
|
required this.parentCommentId,
|
|
required this.isRead,
|
|
required this.createdAt,
|
|
});
|
|
|
|
factory CommentReplied.fromJson(Map<String, dynamic> json, NotificationType type, {bool? isRead, String? createdAt}) {
|
|
return CommentReplied(
|
|
type: type,
|
|
entityName: json['entity_name'],
|
|
commentedEntityId: json['commented_entity_id'],
|
|
commentedEntityType: json['commented_entity_type'],
|
|
author: json['author'],
|
|
authorId: json['author_id'],
|
|
parentCommentId: json['parrent_comment_id'],
|
|
isRead: isRead ?? false,
|
|
createdAt: parseDate(createdAt ?? json['created_at'] ?? DateTime.now().toIso8601String()),
|
|
);
|
|
}
|
|
}
|
|
|
|
class ScoreAdded implements BaseNotificationModel {
|
|
@override
|
|
final NotificationType type;
|
|
@override
|
|
final bool isRead;
|
|
final String scoreKey;
|
|
final int scorableId;
|
|
final String scorableType;
|
|
final String scorableName;
|
|
final String scorableSlug;
|
|
final int scoreValue;
|
|
@override
|
|
final DateTime createdAt;
|
|
|
|
ScoreAdded({
|
|
required this.type,
|
|
required this.scoreKey,
|
|
required this.scorableId,
|
|
required this.scorableType,
|
|
required this.scorableName,
|
|
required this.scorableSlug,
|
|
required this.scoreValue,
|
|
required this.isRead,
|
|
required this.createdAt,
|
|
});
|
|
|
|
factory ScoreAdded.fromJson(Map<String, dynamic> json, NotificationType type, {bool? isRead, String? createdAt}) {
|
|
return ScoreAdded(
|
|
type: type,
|
|
scoreKey: json['score_key'],
|
|
scorableId: json['scorable_id'],
|
|
scorableType: json['scorable_type'],
|
|
scorableName: json['scorable_name'] ?? '',
|
|
scorableSlug: json['scorable_slug'] ?? '',
|
|
scoreValue: json['score_value'],
|
|
isRead: isRead ?? false,
|
|
createdAt: parseDate(createdAt ?? json['created_at'] ?? DateTime.now().toIso8601String()),
|
|
);
|
|
}
|
|
}
|
|
|
|
class EntityCommented implements BaseNotificationModel {
|
|
@override
|
|
final NotificationType type;
|
|
@override
|
|
final bool isRead;
|
|
final String entityName;
|
|
final int entityId;
|
|
final String entityType;
|
|
final String entityTranslatedType;
|
|
final String entityUrl;
|
|
final String authorName;
|
|
final int authorId;
|
|
final String authorSlug;
|
|
@override
|
|
final DateTime createdAt;
|
|
|
|
EntityCommented({
|
|
required this.type,
|
|
required this.entityName,
|
|
required this.entityId,
|
|
required this.entityType,
|
|
required this.entityTranslatedType,
|
|
required this.entityUrl,
|
|
required this.authorName,
|
|
required this.authorId,
|
|
required this.authorSlug,
|
|
required this.isRead,
|
|
required this.createdAt,
|
|
});
|
|
|
|
factory EntityCommented.fromJson(Map<String, dynamic> json, NotificationType type, {bool? isRead, String? createdAt}) {
|
|
return EntityCommented(
|
|
type: type,
|
|
entityName: json['entity_name'],
|
|
entityId: json['entity_id'],
|
|
entityType: json['entity_type'],
|
|
entityTranslatedType: json['entity_traslated_type'],
|
|
entityUrl: json['entity_url'],
|
|
authorName: json['author_name'],
|
|
authorId: json['author_id'],
|
|
authorSlug: json['author_slug'],
|
|
isRead: isRead ?? false,
|
|
createdAt: parseDate(createdAt ?? json['created_at'] ?? DateTime.now().toIso8601String()),
|
|
);
|
|
}
|
|
}
|
|
|
|
class PlanSubscriptionExpiredNotification implements BaseNotificationModel {
|
|
@override
|
|
final NotificationType type;
|
|
@override
|
|
final bool isRead;
|
|
final String planName;
|
|
final String customerName;
|
|
@override
|
|
final DateTime createdAt;
|
|
|
|
PlanSubscriptionExpiredNotification({required this.type, required this.planName, required this.customerName, required this.isRead, required this.createdAt});
|
|
|
|
factory PlanSubscriptionExpiredNotification.fromJson(Map<String, dynamic> json, NotificationType type, {bool? isRead, String? createdAt}) {
|
|
return PlanSubscriptionExpiredNotification(
|
|
type: type,
|
|
planName: json['plan_name'],
|
|
customerName: json['user_name'],
|
|
isRead: isRead ?? false,
|
|
createdAt: parseDate(createdAt ?? json['created_at'] ?? DateTime.now().toIso8601String()),
|
|
);
|
|
}
|
|
}
|
|
|
|
class PlanSubscriptionRenewedNotification implements BaseNotificationModel {
|
|
@override
|
|
final NotificationType type;
|
|
@override
|
|
final bool isRead;
|
|
final String planName;
|
|
final String customerName;
|
|
final String renewalDate;
|
|
@override
|
|
final DateTime createdAt;
|
|
|
|
PlanSubscriptionRenewedNotification({
|
|
required this.type,
|
|
required this.planName,
|
|
required this.customerName,
|
|
required this.renewalDate,
|
|
required this.isRead,
|
|
required this.createdAt,
|
|
});
|
|
|
|
factory PlanSubscriptionRenewedNotification.fromJson(Map<String, dynamic> json, NotificationType type, {bool? isRead, String? createdAt}) {
|
|
return PlanSubscriptionRenewedNotification(
|
|
type: type,
|
|
planName: json['plan_name'],
|
|
customerName: json['user_name'],
|
|
renewalDate: json['renewal_date'],
|
|
isRead: isRead ?? false,
|
|
createdAt: parseDate(createdAt ?? json['created_at'] ?? DateTime.now().toIso8601String()),
|
|
);
|
|
}
|
|
}
|
|
|
|
class ConsultantAssignedNotification implements BaseNotificationModel {
|
|
@override
|
|
final NotificationType type;
|
|
@override
|
|
final bool isRead;
|
|
final String consultantName;
|
|
final String planName;
|
|
final int planId;
|
|
@override
|
|
final DateTime createdAt;
|
|
|
|
ConsultantAssignedNotification({
|
|
required this.type,
|
|
required this.consultantName,
|
|
required this.planName,
|
|
required this.planId,
|
|
required this.isRead,
|
|
required this.createdAt,
|
|
});
|
|
|
|
factory ConsultantAssignedNotification.fromJson(Map<String, dynamic> json, NotificationType type, {bool? isRead, String? createdAt}) {
|
|
return ConsultantAssignedNotification(
|
|
type: type,
|
|
consultantName: json['consultant_name'],
|
|
planName: json['plan_name'],
|
|
planId: json['plan_id'],
|
|
isRead: isRead ?? false,
|
|
createdAt: parseDate(createdAt ?? json['created_at'] ?? DateTime.now().toIso8601String()),
|
|
);
|
|
}
|
|
}
|
|
|
|
class ConsultantUnassignedNotification implements BaseNotificationModel {
|
|
@override
|
|
final NotificationType type;
|
|
@override
|
|
final bool isRead;
|
|
final String consultantName;
|
|
final String planName;
|
|
final int planId;
|
|
@override
|
|
final DateTime createdAt;
|
|
|
|
ConsultantUnassignedNotification({
|
|
required this.type,
|
|
required this.consultantName,
|
|
required this.planName,
|
|
required this.planId,
|
|
required this.isRead,
|
|
required this.createdAt,
|
|
});
|
|
|
|
factory ConsultantUnassignedNotification.fromJson(Map<String, dynamic> json, NotificationType type, {bool? isRead, String? createdAt}) {
|
|
return ConsultantUnassignedNotification(
|
|
type: type,
|
|
consultantName: json['consultant_name'],
|
|
planName: json['plan_name'],
|
|
planId: json['plan_id'],
|
|
isRead: isRead ?? false,
|
|
createdAt: parseDate(createdAt ?? json['created_at'] ?? DateTime.now().toIso8601String()),
|
|
);
|
|
}
|
|
}
|
|
|
|
class PaymentFailedNotification implements BaseNotificationModel {
|
|
@override
|
|
final NotificationType type;
|
|
@override
|
|
final bool isRead;
|
|
final String planName;
|
|
final String errorMessage;
|
|
final String paymentMethod;
|
|
@override
|
|
final DateTime createdAt;
|
|
|
|
PaymentFailedNotification({
|
|
required this.type,
|
|
required this.planName,
|
|
required this.errorMessage,
|
|
required this.paymentMethod,
|
|
required this.isRead,
|
|
required this.createdAt,
|
|
});
|
|
|
|
factory PaymentFailedNotification.fromJson(Map<String, dynamic> json, NotificationType type, {bool? isRead, String? createdAt}) {
|
|
return PaymentFailedNotification(
|
|
type: type,
|
|
planName: json['plan_name'],
|
|
errorMessage: json['error_message'],
|
|
paymentMethod: json['payment_method'],
|
|
isRead: isRead ?? false,
|
|
createdAt: parseDate(createdAt ?? json['created_at'] ?? DateTime.now().toIso8601String()),
|
|
);
|
|
}
|
|
}
|
|
|
|
class PaymentSuccessfulNotification implements BaseNotificationModel {
|
|
@override
|
|
final NotificationType type;
|
|
@override
|
|
final bool isRead;
|
|
final String planName;
|
|
final double amount;
|
|
final String currency;
|
|
final String transactionId;
|
|
@override
|
|
final DateTime createdAt;
|
|
|
|
PaymentSuccessfulNotification({
|
|
required this.type,
|
|
required this.planName,
|
|
required this.amount,
|
|
required this.currency,
|
|
required this.transactionId,
|
|
required this.isRead,
|
|
required this.createdAt,
|
|
});
|
|
|
|
factory PaymentSuccessfulNotification.fromJson(Map<String, dynamic> json, NotificationType type, {bool? isRead, String? createdAt}) {
|
|
return PaymentSuccessfulNotification(
|
|
type: type,
|
|
planName: json['plan_name'],
|
|
amount: (json['amount'] as num).toDouble(),
|
|
currency: json['currency'],
|
|
transactionId: json['transaction_id'],
|
|
isRead: isRead ?? false,
|
|
createdAt: parseDate(createdAt ?? json['created_at'] ?? DateTime.now().toIso8601String()),
|
|
);
|
|
}
|
|
}
|
|
|
|
class GoalAchievedNotification implements BaseNotificationModel {
|
|
@override
|
|
final NotificationType type;
|
|
@override
|
|
final bool isRead;
|
|
final String goalName;
|
|
final String goalType;
|
|
final double achievedValue;
|
|
final double targetValue;
|
|
@override
|
|
final DateTime createdAt;
|
|
|
|
GoalAchievedNotification({
|
|
required this.type,
|
|
required this.goalName,
|
|
required this.goalType,
|
|
required this.achievedValue,
|
|
required this.targetValue,
|
|
required this.isRead,
|
|
required this.createdAt,
|
|
});
|
|
|
|
factory GoalAchievedNotification.fromJson(Map<String, dynamic> json, NotificationType type, {bool? isRead, String? createdAt}) {
|
|
return GoalAchievedNotification(
|
|
type: type,
|
|
goalName: json['goal_name'],
|
|
goalType: json['goal_type'],
|
|
achievedValue: (json['achieved_value'] as num).toDouble(),
|
|
targetValue: (json['target_value'] as num).toDouble(),
|
|
isRead: isRead ?? false,
|
|
createdAt: parseDate(createdAt ?? json['created_at'] ?? DateTime.now().toIso8601String()),
|
|
);
|
|
}
|
|
}
|
|
|
|
class WorkoutReminderNotification implements BaseNotificationModel {
|
|
@override
|
|
final NotificationType type;
|
|
@override
|
|
final bool isRead;
|
|
final String workoutName;
|
|
final String workoutType;
|
|
final int duration;
|
|
@override
|
|
final DateTime createdAt;
|
|
|
|
WorkoutReminderNotification({
|
|
required this.type,
|
|
required this.workoutName,
|
|
required this.workoutType,
|
|
required this.duration,
|
|
required this.isRead,
|
|
required this.createdAt,
|
|
});
|
|
|
|
factory WorkoutReminderNotification.fromJson(Map<String, dynamic> json, NotificationType type, {bool? isRead, String? createdAt}) {
|
|
return WorkoutReminderNotification(
|
|
type: type,
|
|
workoutName: json['workout_name'],
|
|
workoutType: json['workout_type'],
|
|
duration: json['duration'],
|
|
isRead: isRead ?? false,
|
|
createdAt: parseDate(createdAt ?? json['created_at'] ?? DateTime.now().toIso8601String()),
|
|
);
|
|
}
|
|
}
|
|
|
|
class MealReminderNotification implements BaseNotificationModel {
|
|
@override
|
|
final NotificationType type;
|
|
@override
|
|
final bool isRead;
|
|
final String mealName;
|
|
final String mealType;
|
|
final int calories;
|
|
@override
|
|
final DateTime createdAt;
|
|
|
|
MealReminderNotification({
|
|
required this.type,
|
|
required this.mealName,
|
|
required this.mealType,
|
|
required this.calories,
|
|
required this.isRead,
|
|
required this.createdAt,
|
|
});
|
|
|
|
factory MealReminderNotification.fromJson(Map<String, dynamic> json, NotificationType type, {bool? isRead, String? createdAt}) {
|
|
return MealReminderNotification(
|
|
type: type,
|
|
mealName: json['meal_name'],
|
|
mealType: json['meal_type'],
|
|
calories: json['calories'],
|
|
isRead: isRead ?? false,
|
|
createdAt: parseDate(createdAt ?? json['created_at'] ?? DateTime.now().toIso8601String()),
|
|
);
|
|
}
|
|
}
|
|
|
|
class UnknownNotification implements BaseNotificationModel {
|
|
@override
|
|
final NotificationType type;
|
|
@override
|
|
final bool isRead;
|
|
@override
|
|
final DateTime createdAt;
|
|
|
|
UnknownNotification({required this.type, this.isRead = true, DateTime? createdAt}) : createdAt = createdAt ?? DateTime.fromMillisecondsSinceEpoch(0);
|
|
}
|
|
|
|
class DietCancelledNotification implements BaseNotificationModel {
|
|
@override
|
|
final NotificationType type;
|
|
@override
|
|
final bool isRead;
|
|
final String dietName;
|
|
@override
|
|
final DateTime createdAt;
|
|
|
|
DietCancelledNotification({required this.type, required this.dietName, required this.isRead, required this.createdAt});
|
|
|
|
factory DietCancelledNotification.fromJson(Map<String, dynamic> json, NotificationType type, {bool? isRead, String? createdAt}) {
|
|
return DietCancelledNotification(
|
|
type: type,
|
|
dietName: json['diet_name'] ?? '',
|
|
isRead: isRead ?? false,
|
|
createdAt: parseDate(createdAt ?? json['created_at'] ?? DateTime.now().toIso8601String()),
|
|
);
|
|
}
|
|
}
|
|
|
|
class DietStartedNotification implements BaseNotificationModel {
|
|
@override
|
|
final NotificationType type;
|
|
@override
|
|
final bool isRead;
|
|
final String dietName;
|
|
@override
|
|
final DateTime createdAt;
|
|
|
|
DietStartedNotification({required this.type, required this.dietName, required this.isRead, required this.createdAt});
|
|
|
|
factory DietStartedNotification.fromJson(Map<String, dynamic> json, NotificationType type, {bool? isRead, String? createdAt}) {
|
|
return DietStartedNotification(
|
|
type: type,
|
|
dietName: json['diet_name'] ?? '',
|
|
isRead: isRead ?? false,
|
|
createdAt: parseDate(createdAt ?? json['created_at'] ?? DateTime.now().toIso8601String()),
|
|
);
|
|
}
|
|
}
|
|
|
|
class DietExpiredNotification implements BaseNotificationModel {
|
|
@override
|
|
final NotificationType type;
|
|
@override
|
|
final bool isRead;
|
|
final String dietName;
|
|
@override
|
|
final DateTime createdAt;
|
|
|
|
DietExpiredNotification({required this.type, required this.dietName, required this.isRead, required this.createdAt});
|
|
|
|
factory DietExpiredNotification.fromJson(Map<String, dynamic> json, NotificationType type, {bool? isRead, String? createdAt}) {
|
|
return DietExpiredNotification(
|
|
type: type,
|
|
dietName: json['diet_name'] ?? '',
|
|
isRead: isRead ?? false,
|
|
createdAt: parseDate(createdAt ?? json['created_at'] ?? DateTime.now().toIso8601String()),
|
|
);
|
|
}
|
|
}
|
|
|
|
class DietWillStartedInNotification implements BaseNotificationModel {
|
|
@override
|
|
final NotificationType type;
|
|
@override
|
|
final bool isRead;
|
|
final String dietName;
|
|
final String startDate;
|
|
@override
|
|
final DateTime createdAt;
|
|
|
|
DietWillStartedInNotification({required this.type, required this.dietName, required this.startDate, required this.isRead, required this.createdAt});
|
|
|
|
factory DietWillStartedInNotification.fromJson(Map<String, dynamic> json, NotificationType type, {bool? isRead, String? createdAt}) {
|
|
return DietWillStartedInNotification(
|
|
type: type,
|
|
dietName: json['diet_name'] ?? '',
|
|
startDate: json['start_date'] ?? '',
|
|
isRead: isRead ?? false,
|
|
createdAt: parseDate(createdAt ?? json['created_at'] ?? DateTime.now().toIso8601String()),
|
|
);
|
|
}
|
|
}
|
|
|
|
class DietCanNotBeStartedNotification implements BaseNotificationModel {
|
|
@override
|
|
final NotificationType type;
|
|
@override
|
|
final bool isRead;
|
|
final String dietName;
|
|
final String reason;
|
|
@override
|
|
final DateTime createdAt;
|
|
|
|
DietCanNotBeStartedNotification({required this.type, required this.dietName, required this.reason, required this.isRead, required this.createdAt});
|
|
|
|
factory DietCanNotBeStartedNotification.fromJson(Map<String, dynamic> json, NotificationType type, {bool? isRead, String? createdAt}) {
|
|
return DietCanNotBeStartedNotification(
|
|
type: type,
|
|
dietName: json['diet_name'] ?? '',
|
|
reason: json['reason'] ?? '',
|
|
isRead: isRead ?? false,
|
|
createdAt: parseDate(createdAt ?? json['created_at'] ?? DateTime.now().toIso8601String()),
|
|
);
|
|
}
|
|
}
|
|
|
|
class PersonalDietCreationNeededNotification implements BaseNotificationModel {
|
|
@override
|
|
final NotificationType type;
|
|
@override
|
|
final bool isRead;
|
|
final String planName;
|
|
final String clientName;
|
|
@override
|
|
final DateTime createdAt;
|
|
|
|
PersonalDietCreationNeededNotification({required this.type, required this.planName, required this.clientName, required this.isRead, required this.createdAt});
|
|
|
|
factory PersonalDietCreationNeededNotification.fromJson(Map<String, dynamic> json, NotificationType type, {bool? isRead, String? createdAt}) {
|
|
return PersonalDietCreationNeededNotification(
|
|
type: type,
|
|
planName: json['plan_name'] ?? '',
|
|
clientName: json['client_name'] ?? '',
|
|
isRead: isRead ?? false,
|
|
createdAt: parseDate(createdAt ?? json['created_at'] ?? DateTime.now().toIso8601String()),
|
|
);
|
|
}
|
|
}
|
|
|
|
class ChosenPlanClientLastDayFinishedNotification implements BaseNotificationModel {
|
|
@override
|
|
final NotificationType type;
|
|
@override
|
|
final bool isRead;
|
|
final String planName;
|
|
@override
|
|
final DateTime createdAt;
|
|
|
|
ChosenPlanClientLastDayFinishedNotification({required this.type, required this.planName, required this.isRead, required this.createdAt});
|
|
|
|
factory ChosenPlanClientLastDayFinishedNotification.fromJson(Map<String, dynamic> json, NotificationType type, {bool? isRead, String? createdAt}) {
|
|
return ChosenPlanClientLastDayFinishedNotification(
|
|
type: type,
|
|
planName: json['plan_name'] ?? '',
|
|
isRead: isRead ?? false,
|
|
createdAt: parseDate(createdAt ?? json['created_at'] ?? DateTime.now().toIso8601String()),
|
|
);
|
|
}
|
|
}
|
|
|
|
class ChosenPlanClientLastDayStartedNotification implements BaseNotificationModel {
|
|
@override
|
|
final NotificationType type;
|
|
@override
|
|
final bool isRead;
|
|
final String planName;
|
|
@override
|
|
final DateTime createdAt;
|
|
|
|
ChosenPlanClientLastDayStartedNotification({required this.type, required this.planName, required this.isRead, required this.createdAt});
|
|
|
|
factory ChosenPlanClientLastDayStartedNotification.fromJson(Map<String, dynamic> json, NotificationType type, {bool? isRead, String? createdAt}) {
|
|
return ChosenPlanClientLastDayStartedNotification(
|
|
type: type,
|
|
planName: json['plan_name'] ?? '',
|
|
isRead: isRead ?? false,
|
|
createdAt: parseDate(createdAt ?? json['created_at'] ?? DateTime.now().toIso8601String()),
|
|
);
|
|
}
|
|
}
|
|
|
|
class StayOnTrackToAuthorNotification implements BaseNotificationModel {
|
|
@override
|
|
final NotificationType type;
|
|
@override
|
|
final bool isRead;
|
|
final String planName;
|
|
final String clientName;
|
|
@override
|
|
final DateTime createdAt;
|
|
|
|
StayOnTrackToAuthorNotification({required this.type, required this.planName, required this.clientName, required this.isRead, required this.createdAt});
|
|
|
|
factory StayOnTrackToAuthorNotification.fromJson(Map<String, dynamic> json, NotificationType type, {bool? isRead, String? createdAt}) {
|
|
return StayOnTrackToAuthorNotification(
|
|
type: type,
|
|
planName: json['plan_name'] ?? '',
|
|
clientName: json['client_name'] ?? '',
|
|
isRead: isRead ?? false,
|
|
createdAt: parseDate(createdAt ?? json['created_at'] ?? DateTime.now().toIso8601String()),
|
|
);
|
|
}
|
|
}
|
|
|
|
class ClientStartPlanSubscriptionToSubscriberNotification implements BaseNotificationModel {
|
|
@override
|
|
final NotificationType type;
|
|
@override
|
|
final bool isRead;
|
|
final String planName;
|
|
@override
|
|
final DateTime createdAt;
|
|
|
|
ClientStartPlanSubscriptionToSubscriberNotification({required this.type, required this.planName, required this.isRead, required this.createdAt});
|
|
|
|
factory ClientStartPlanSubscriptionToSubscriberNotification.fromJson(Map<String, dynamic> json, NotificationType type, {bool? isRead, String? createdAt}) {
|
|
return ClientStartPlanSubscriptionToSubscriberNotification(
|
|
type: type,
|
|
planName: json['plan_name'] ?? '',
|
|
isRead: isRead ?? false,
|
|
createdAt: parseDate(createdAt ?? json['created_at'] ?? DateTime.now().toIso8601String()),
|
|
);
|
|
}
|
|
}
|
|
|
|
class ConsultantConfirmPlanSubscriptionToSubscriberNotification implements BaseNotificationModel {
|
|
@override
|
|
final NotificationType type;
|
|
@override
|
|
final bool isRead;
|
|
final String planName;
|
|
final String consultantName;
|
|
@override
|
|
final DateTime createdAt;
|
|
|
|
ConsultantConfirmPlanSubscriptionToSubscriberNotification({
|
|
required this.type,
|
|
required this.planName,
|
|
required this.consultantName,
|
|
required this.isRead,
|
|
required this.createdAt,
|
|
});
|
|
|
|
factory ConsultantConfirmPlanSubscriptionToSubscriberNotification.fromJson(
|
|
Map<String, dynamic> json,
|
|
NotificationType type, {
|
|
bool? isRead,
|
|
String? createdAt,
|
|
}) {
|
|
return ConsultantConfirmPlanSubscriptionToSubscriberNotification(
|
|
type: type,
|
|
planName: json['plan_name'] ?? '',
|
|
consultantName: json['consultant_name'] ?? '',
|
|
isRead: isRead ?? false,
|
|
createdAt: parseDate(createdAt ?? json['created_at'] ?? DateTime.now().toIso8601String()),
|
|
);
|
|
}
|
|
}
|
|
|
|
class ClientPaidPlanSubscriptionToAuthorNotification implements BaseNotificationModel {
|
|
@override
|
|
final NotificationType type;
|
|
@override
|
|
final bool isRead;
|
|
final String planName;
|
|
final String clientName;
|
|
final double amount;
|
|
@override
|
|
final DateTime createdAt;
|
|
|
|
ClientPaidPlanSubscriptionToAuthorNotification({
|
|
required this.type,
|
|
required this.planName,
|
|
required this.clientName,
|
|
required this.amount,
|
|
required this.isRead,
|
|
required this.createdAt,
|
|
});
|
|
|
|
factory ClientPaidPlanSubscriptionToAuthorNotification.fromJson(Map<String, dynamic> json, NotificationType type, {bool? isRead, String? createdAt}) {
|
|
return ClientPaidPlanSubscriptionToAuthorNotification(
|
|
type: type,
|
|
planName: json['plan_name'] ?? '',
|
|
clientName: json['client_name'] ?? '',
|
|
amount: (json['amount'] as num?)?.toDouble() ?? 0.0,
|
|
isRead: isRead ?? false,
|
|
createdAt: parseDate(createdAt ?? json['created_at'] ?? DateTime.now().toIso8601String()),
|
|
);
|
|
}
|
|
}
|
|
|
|
class ConsultantLeftDiaryCommentNotification implements BaseNotificationModel {
|
|
@override
|
|
final NotificationType type;
|
|
@override
|
|
final bool isRead;
|
|
final String planName;
|
|
final String consultantName;
|
|
final DateTime diaryDate;
|
|
@override
|
|
final DateTime createdAt;
|
|
|
|
ConsultantLeftDiaryCommentNotification({
|
|
required this.type,
|
|
required this.planName,
|
|
required this.consultantName,
|
|
required this.diaryDate,
|
|
required this.isRead,
|
|
required this.createdAt,
|
|
});
|
|
|
|
factory ConsultantLeftDiaryCommentNotification.fromJson(Map<String, dynamic> json, NotificationType type, {bool? isRead, String? createdAt}) {
|
|
return ConsultantLeftDiaryCommentNotification(
|
|
type: type,
|
|
planName: json['plan_name'] ?? '',
|
|
consultantName: json['consultant_name'] ?? '',
|
|
diaryDate: parseDate(json['diary_date'] ?? DateTime.now().toIso8601String()),
|
|
isRead: isRead ?? false,
|
|
createdAt: parseDate(createdAt ?? json['created_at'] ?? DateTime.now().toIso8601String()),
|
|
);
|
|
}
|
|
}
|
|
|
|
class ConsultantConfirmPlanSubscriptionToAuthorNotification implements BaseNotificationModel {
|
|
@override
|
|
final NotificationType type;
|
|
@override
|
|
final bool isRead;
|
|
final String planName;
|
|
final String consultantName;
|
|
@override
|
|
final DateTime createdAt;
|
|
|
|
ConsultantConfirmPlanSubscriptionToAuthorNotification({
|
|
required this.type,
|
|
required this.planName,
|
|
required this.consultantName,
|
|
required this.isRead,
|
|
required this.createdAt,
|
|
});
|
|
|
|
factory ConsultantConfirmPlanSubscriptionToAuthorNotification.fromJson(Map<String, dynamic> json, NotificationType type, {bool? isRead, String? createdAt}) {
|
|
return ConsultantConfirmPlanSubscriptionToAuthorNotification(
|
|
type: type,
|
|
planName: json['plan_name'] ?? '',
|
|
consultantName: json['consultant_name'] ?? '',
|
|
isRead: isRead ?? false,
|
|
createdAt: parseDate(createdAt ?? json['created_at'] ?? DateTime.now().toIso8601String()),
|
|
);
|
|
}
|
|
}
|
|
|
|
class ClientPaidPlanSubscriptionToSubscriberNotification implements BaseNotificationModel {
|
|
@override
|
|
final NotificationType type;
|
|
@override
|
|
final bool isRead;
|
|
final String planName;
|
|
final double amount;
|
|
@override
|
|
final DateTime createdAt;
|
|
|
|
ClientPaidPlanSubscriptionToSubscriberNotification({
|
|
required this.type,
|
|
required this.planName,
|
|
required this.amount,
|
|
required this.isRead,
|
|
required this.createdAt,
|
|
});
|
|
|
|
factory ClientPaidPlanSubscriptionToSubscriberNotification.fromJson(Map<String, dynamic> json, NotificationType type, {bool? isRead, String? createdAt}) {
|
|
return ClientPaidPlanSubscriptionToSubscriberNotification(
|
|
type: type,
|
|
planName: json['plan_name'] ?? '',
|
|
amount: (json['amount'] as num?)?.toDouble() ?? 0.0,
|
|
isRead: isRead ?? false,
|
|
createdAt: parseDate(createdAt ?? json['created_at'] ?? DateTime.now().toIso8601String()),
|
|
);
|
|
}
|
|
}
|
|
|
|
class ClientStartPlanSubscriptionToAuthorNotification implements BaseNotificationModel {
|
|
@override
|
|
final NotificationType type;
|
|
@override
|
|
final bool isRead;
|
|
final String planName;
|
|
final String clientName;
|
|
@override
|
|
final DateTime createdAt;
|
|
|
|
ClientStartPlanSubscriptionToAuthorNotification({
|
|
required this.type,
|
|
required this.planName,
|
|
required this.clientName,
|
|
required this.isRead,
|
|
required this.createdAt,
|
|
});
|
|
|
|
factory ClientStartPlanSubscriptionToAuthorNotification.fromJson(Map<String, dynamic> json, NotificationType type, {bool? isRead, String? createdAt}) {
|
|
return ClientStartPlanSubscriptionToAuthorNotification(
|
|
type: type,
|
|
planName: json['plan_name'] ?? '',
|
|
clientName: json['client_name'] ?? '',
|
|
isRead: isRead ?? false,
|
|
createdAt: parseDate(createdAt ?? json['created_at'] ?? DateTime.now().toIso8601String()),
|
|
);
|
|
}
|
|
}
|
|
|
|
class ClientCancelPlanSubscriptionToAuthorNotification implements BaseNotificationModel {
|
|
@override
|
|
final NotificationType type;
|
|
@override
|
|
final bool isRead;
|
|
final String planName;
|
|
final String clientName;
|
|
@override
|
|
final DateTime createdAt;
|
|
|
|
ClientCancelPlanSubscriptionToAuthorNotification({
|
|
required this.type,
|
|
required this.planName,
|
|
required this.clientName,
|
|
required this.isRead,
|
|
required this.createdAt,
|
|
});
|
|
|
|
factory ClientCancelPlanSubscriptionToAuthorNotification.fromJson(Map<String, dynamic> json, NotificationType type, {bool? isRead, String? createdAt}) {
|
|
return ClientCancelPlanSubscriptionToAuthorNotification(
|
|
type: type,
|
|
planName: json['plan_name'] ?? '',
|
|
clientName: json['client_name'] ?? '',
|
|
isRead: isRead ?? false,
|
|
createdAt: parseDate(createdAt ?? json['created_at'] ?? DateTime.now().toIso8601String()),
|
|
);
|
|
}
|
|
}
|
|
|
|
class ClientCancelPlanSubscriptionToSubscriberNotification implements BaseNotificationModel {
|
|
@override
|
|
final NotificationType type;
|
|
@override
|
|
final bool isRead;
|
|
final String planName;
|
|
@override
|
|
final DateTime createdAt;
|
|
|
|
ClientCancelPlanSubscriptionToSubscriberNotification({required this.type, required this.planName, required this.isRead, required this.createdAt});
|
|
|
|
factory ClientCancelPlanSubscriptionToSubscriberNotification.fromJson(Map<String, dynamic> json, NotificationType type, {bool? isRead, String? createdAt}) {
|
|
return ClientCancelPlanSubscriptionToSubscriberNotification(
|
|
type: type,
|
|
planName: json['plan_name'] ?? '',
|
|
isRead: isRead ?? false,
|
|
createdAt: parseDate(createdAt ?? json['created_at'] ?? DateTime.now().toIso8601String()),
|
|
);
|
|
}
|
|
}
|
|
|
|
class UserDailyReportCompletedNotification implements BaseNotificationModel {
|
|
@override
|
|
final NotificationType type;
|
|
@override
|
|
final bool isRead;
|
|
final String planName;
|
|
final String clientName;
|
|
final DateTime reportDate;
|
|
@override
|
|
final DateTime createdAt;
|
|
|
|
UserDailyReportCompletedNotification({
|
|
required this.type,
|
|
required this.planName,
|
|
required this.clientName,
|
|
required this.reportDate,
|
|
required this.isRead,
|
|
required this.createdAt,
|
|
});
|
|
|
|
factory UserDailyReportCompletedNotification.fromJson(Map<String, dynamic> json, NotificationType type, {bool? isRead, String? createdAt}) {
|
|
return UserDailyReportCompletedNotification(
|
|
type: type,
|
|
planName: json['plan_name'] ?? '',
|
|
clientName: json['client_name'] ?? '',
|
|
reportDate: parseDate(json['report_date'] ?? DateTime.now().toIso8601String()),
|
|
isRead: isRead ?? false,
|
|
createdAt: parseDate(createdAt ?? json['created_at'] ?? DateTime.now().toIso8601String()),
|
|
);
|
|
}
|
|
}
|
|
|
|
class StayOnTrackToCustomerNotification implements BaseNotificationModel {
|
|
@override
|
|
final NotificationType type;
|
|
@override
|
|
final bool isRead;
|
|
final String planName;
|
|
final String consultantName;
|
|
@override
|
|
final DateTime createdAt;
|
|
|
|
StayOnTrackToCustomerNotification({required this.type, required this.planName, required this.consultantName, required this.isRead, required this.createdAt});
|
|
|
|
factory StayOnTrackToCustomerNotification.fromJson(Map<String, dynamic> json, NotificationType type, {bool? isRead, String? createdAt}) {
|
|
return StayOnTrackToCustomerNotification(
|
|
type: type,
|
|
planName: json['plan_name'] ?? '',
|
|
consultantName: json['consultant_name'] ?? '',
|
|
isRead: isRead ?? false,
|
|
createdAt: parseDate(createdAt ?? json['created_at'] ?? DateTime.now().toIso8601String()),
|
|
);
|
|
}
|
|
}
|
|
|
|
class PhoneChangedNotification implements BaseNotificationModel {
|
|
@override
|
|
final NotificationType type;
|
|
@override
|
|
final bool isRead;
|
|
final String oldPhone;
|
|
final String newPhone;
|
|
@override
|
|
final DateTime createdAt;
|
|
|
|
PhoneChangedNotification({required this.type, required this.oldPhone, required this.newPhone, required this.isRead, required this.createdAt});
|
|
|
|
factory PhoneChangedNotification.fromJson(Map<String, dynamic> json, NotificationType type, {bool? isRead, String? createdAt}) {
|
|
return PhoneChangedNotification(
|
|
type: type,
|
|
oldPhone: json['old_phone'] ?? '',
|
|
newPhone: json['new_phone'] ?? '',
|
|
isRead: isRead ?? false,
|
|
createdAt: parseDate(createdAt ?? json['created_at'] ?? DateTime.now().toIso8601String()),
|
|
);
|
|
}
|
|
}
|
|
|
|
class SubscriptionNotification implements BaseNotificationModel {
|
|
@override
|
|
final NotificationType type;
|
|
@override
|
|
final bool isRead;
|
|
final String subscriptionType;
|
|
final String planName;
|
|
@override
|
|
final DateTime createdAt;
|
|
|
|
SubscriptionNotification({required this.type, required this.subscriptionType, required this.planName, required this.isRead, required this.createdAt});
|
|
|
|
factory SubscriptionNotification.fromJson(Map<String, dynamic> json, NotificationType type, {bool? isRead, String? createdAt}) {
|
|
return SubscriptionNotification(
|
|
type: type,
|
|
subscriptionType: json['subscription_type'] ?? '',
|
|
planName: json['plan_name'] ?? '',
|
|
isRead: isRead ?? false,
|
|
createdAt: parseDate(createdAt ?? json['created_at'] ?? DateTime.now().toIso8601String()),
|
|
);
|
|
}
|
|
}
|
|
|
|
class BadgeAwardedNotification implements BaseNotificationModel {
|
|
@override
|
|
final NotificationType type;
|
|
@override
|
|
final bool isRead;
|
|
final String badgeName;
|
|
final String badgeDescription;
|
|
@override
|
|
final DateTime createdAt;
|
|
|
|
BadgeAwardedNotification({required this.type, required this.badgeName, required this.badgeDescription, required this.isRead, required this.createdAt});
|
|
|
|
factory BadgeAwardedNotification.fromJson(Map<String, dynamic> json, NotificationType type, {bool? isRead, String? createdAt}) {
|
|
return BadgeAwardedNotification(
|
|
type: type,
|
|
badgeName: json['badge_name'] ?? '',
|
|
badgeDescription: json['badge_description'] ?? '',
|
|
isRead: isRead ?? false,
|
|
createdAt: parseDate(createdAt ?? json['created_at'] ?? DateTime.now().toIso8601String()),
|
|
);
|
|
}
|
|
}
|
|
|
|
class BadgeRevokedNotification implements BaseNotificationModel {
|
|
@override
|
|
final NotificationType type;
|
|
@override
|
|
final bool isRead;
|
|
final String badgeName;
|
|
final String reason;
|
|
@override
|
|
final DateTime createdAt;
|
|
|
|
BadgeRevokedNotification({required this.type, required this.badgeName, required this.reason, required this.isRead, required this.createdAt});
|
|
|
|
factory BadgeRevokedNotification.fromJson(Map<String, dynamic> json, NotificationType type, {bool? isRead, String? createdAt}) {
|
|
return BadgeRevokedNotification(
|
|
type: type,
|
|
badgeName: json['badge_name'] ?? '',
|
|
reason: json['reason'] ?? '',
|
|
isRead: isRead ?? false,
|
|
createdAt: parseDate(createdAt ?? json['created_at'] ?? DateTime.now().toIso8601String()),
|
|
);
|
|
}
|
|
}
|
|
|
|
class ConsultantRequestStartedNotification implements BaseNotificationModel {
|
|
@override
|
|
final NotificationType type;
|
|
@override
|
|
final bool isRead;
|
|
final String consultantName;
|
|
@override
|
|
final DateTime createdAt;
|
|
|
|
ConsultantRequestStartedNotification({required this.type, required this.consultantName, required this.isRead, required this.createdAt});
|
|
|
|
factory ConsultantRequestStartedNotification.fromJson(Map<String, dynamic> json, NotificationType type, {bool? isRead, String? createdAt}) {
|
|
return ConsultantRequestStartedNotification(
|
|
type: type,
|
|
consultantName: json['consultant_name'] ?? '',
|
|
isRead: isRead ?? false,
|
|
createdAt: parseDate(createdAt ?? json['created_at'] ?? DateTime.now().toIso8601String()),
|
|
);
|
|
}
|
|
}
|
|
|
|
class ClientCloseComplaintSuccessNotification implements BaseNotificationModel {
|
|
@override
|
|
final NotificationType type;
|
|
@override
|
|
final bool isRead;
|
|
final String complaintType;
|
|
final String entityName;
|
|
@override
|
|
final DateTime createdAt;
|
|
|
|
ClientCloseComplaintSuccessNotification({
|
|
required this.type,
|
|
required this.complaintType,
|
|
required this.entityName,
|
|
required this.isRead,
|
|
required this.createdAt,
|
|
});
|
|
|
|
factory ClientCloseComplaintSuccessNotification.fromJson(Map<String, dynamic> json, NotificationType type, {bool? isRead, String? createdAt}) {
|
|
return ClientCloseComplaintSuccessNotification(
|
|
type: type,
|
|
complaintType: json['complaint_type'] ?? '',
|
|
entityName: json['entity_name'] ?? '',
|
|
isRead: isRead ?? false,
|
|
createdAt: parseDate(createdAt ?? json['created_at'] ?? DateTime.now().toIso8601String()),
|
|
);
|
|
}
|
|
}
|
|
|
|
class ClientRefundSuccessNotification implements BaseNotificationModel {
|
|
@override
|
|
final NotificationType type;
|
|
@override
|
|
final bool isRead;
|
|
final String planName;
|
|
final double amount;
|
|
final String reason;
|
|
@override
|
|
final DateTime createdAt;
|
|
|
|
ClientRefundSuccessNotification({
|
|
required this.type,
|
|
required this.planName,
|
|
required this.amount,
|
|
required this.reason,
|
|
required this.isRead,
|
|
required this.createdAt,
|
|
});
|
|
|
|
factory ClientRefundSuccessNotification.fromJson(Map<String, dynamic> json, NotificationType type, {bool? isRead, String? createdAt}) {
|
|
return ClientRefundSuccessNotification(
|
|
type: type,
|
|
planName: json['plan_name'] ?? '',
|
|
amount: (json['amount'] as num?)?.toDouble() ?? 0.0,
|
|
reason: json['reason'] ?? '',
|
|
isRead: isRead ?? false,
|
|
createdAt: parseDate(createdAt ?? json['created_at'] ?? DateTime.now().toIso8601String()),
|
|
);
|
|
}
|
|
}
|
|
|
|
class ConsultantRefundSuccessNotification implements BaseNotificationModel {
|
|
@override
|
|
final NotificationType type;
|
|
@override
|
|
final bool isRead;
|
|
final String planName;
|
|
final String clientName;
|
|
final double amount;
|
|
@override
|
|
final DateTime createdAt;
|
|
|
|
ConsultantRefundSuccessNotification({
|
|
required this.type,
|
|
required this.planName,
|
|
required this.clientName,
|
|
required this.amount,
|
|
required this.isRead,
|
|
required this.createdAt,
|
|
});
|
|
|
|
factory ConsultantRefundSuccessNotification.fromJson(Map<String, dynamic> json, NotificationType type, {bool? isRead, String? createdAt}) {
|
|
return ConsultantRefundSuccessNotification(
|
|
type: type,
|
|
planName: json['plan_name'] ?? '',
|
|
clientName: json['client_name'] ?? '',
|
|
amount: (json['amount'] as num?)?.toDouble() ?? 0.0,
|
|
isRead: isRead ?? false,
|
|
createdAt: parseDate(createdAt ?? json['created_at'] ?? DateTime.now().toIso8601String()),
|
|
);
|
|
}
|
|
}
|
|
|
|
class ClientRejectSuccessNotification implements BaseNotificationModel {
|
|
@override
|
|
final NotificationType type;
|
|
@override
|
|
final bool isRead;
|
|
final String planName;
|
|
final String reason;
|
|
@override
|
|
final DateTime createdAt;
|
|
|
|
ClientRejectSuccessNotification({required this.type, required this.planName, required this.reason, required this.isRead, required this.createdAt});
|
|
|
|
factory ClientRejectSuccessNotification.fromJson(Map<String, dynamic> json, NotificationType type, {bool? isRead, String? createdAt}) {
|
|
return ClientRejectSuccessNotification(
|
|
type: type,
|
|
planName: json['plan_name'] ?? '',
|
|
reason: json['reason'] ?? '',
|
|
isRead: isRead ?? false,
|
|
createdAt: parseDate(createdAt ?? json['created_at'] ?? DateTime.now().toIso8601String()),
|
|
);
|
|
}
|
|
}
|
|
|
|
class ConsultantRejectSuccessNotification implements BaseNotificationModel {
|
|
@override
|
|
final NotificationType type;
|
|
@override
|
|
final bool isRead;
|
|
final String planName;
|
|
final String clientName;
|
|
final String reason;
|
|
@override
|
|
final DateTime createdAt;
|
|
|
|
ConsultantRejectSuccessNotification({
|
|
required this.type,
|
|
required this.planName,
|
|
required this.clientName,
|
|
required this.reason,
|
|
required this.isRead,
|
|
required this.createdAt,
|
|
});
|
|
|
|
factory ConsultantRejectSuccessNotification.fromJson(Map<String, dynamic> json, NotificationType type, {bool? isRead, String? createdAt}) {
|
|
return ConsultantRejectSuccessNotification(
|
|
type: type,
|
|
planName: json['plan_name'] ?? '',
|
|
clientName: json['client_name'] ?? '',
|
|
reason: json['reason'] ?? '',
|
|
isRead: isRead ?? false,
|
|
createdAt: parseDate(createdAt ?? json['created_at'] ?? DateTime.now().toIso8601String()),
|
|
);
|
|
}
|
|
}
|
|
|
|
class ScoreSubstractedNotification implements BaseNotificationModel {
|
|
@override
|
|
final NotificationType type;
|
|
@override
|
|
final bool isRead;
|
|
final String scoreKey;
|
|
final int scorableId;
|
|
final String scorableType;
|
|
final String scorableName;
|
|
final String scorableSlug;
|
|
final int scoreValue;
|
|
@override
|
|
final DateTime createdAt;
|
|
|
|
ScoreSubstractedNotification({
|
|
required this.type,
|
|
required this.scoreKey,
|
|
required this.scorableId,
|
|
required this.scorableType,
|
|
required this.scorableName,
|
|
required this.scorableSlug,
|
|
required this.scoreValue,
|
|
required this.isRead,
|
|
required this.createdAt,
|
|
});
|
|
|
|
factory ScoreSubstractedNotification.fromJson(Map<String, dynamic> json, NotificationType type, {bool? isRead, String? createdAt}) {
|
|
return ScoreSubstractedNotification(
|
|
type: type,
|
|
scoreKey: json['score_key'],
|
|
scorableId: json['scorable_id'],
|
|
scorableType: json['scorable_type'],
|
|
scorableName: json['scorable_name'] ?? '',
|
|
scorableSlug: json['scorable_slug'] ?? '',
|
|
scoreValue: json['score_value'],
|
|
isRead: isRead ?? false,
|
|
createdAt: parseDate(createdAt ?? json['created_at'] ?? DateTime.now().toIso8601String()),
|
|
);
|
|
}
|
|
}
|
|
|
|
class ProductStatusUpdatedForAuthorNotification implements BaseNotificationModel {
|
|
@override
|
|
final NotificationType type;
|
|
@override
|
|
final bool isRead;
|
|
final String productName;
|
|
final String oldStatus;
|
|
final String newStatus;
|
|
@override
|
|
final DateTime createdAt;
|
|
|
|
ProductStatusUpdatedForAuthorNotification({
|
|
required this.type,
|
|
required this.productName,
|
|
required this.oldStatus,
|
|
required this.newStatus,
|
|
required this.isRead,
|
|
required this.createdAt,
|
|
});
|
|
|
|
factory ProductStatusUpdatedForAuthorNotification.fromJson(Map<String, dynamic> json, NotificationType type, {bool? isRead, String? createdAt}) {
|
|
return ProductStatusUpdatedForAuthorNotification(
|
|
type: type,
|
|
productName: json['product_name'] ?? '',
|
|
oldStatus: json['old_status'] ?? '',
|
|
newStatus: json['new_status'] ?? '',
|
|
isRead: isRead ?? false,
|
|
createdAt: parseDate(createdAt ?? json['created_at'] ?? DateTime.now().toIso8601String()),
|
|
);
|
|
}
|
|
}
|
|
|
|
class DiaryReminderForUsersNotification implements BaseNotificationModel {
|
|
@override
|
|
final NotificationType type;
|
|
@override
|
|
final bool isRead;
|
|
@override
|
|
final DateTime createdAt;
|
|
|
|
DiaryReminderForUsersNotification({required this.type, required this.isRead, required this.createdAt});
|
|
|
|
factory DiaryReminderForUsersNotification.fromJson(Map<String, dynamic> json, NotificationType type, {bool? isRead, String? createdAt}) {
|
|
return DiaryReminderForUsersNotification(
|
|
type: type,
|
|
isRead: isRead ?? false,
|
|
createdAt: parseDate(createdAt ?? json['created_at'] ?? DateTime.now().toIso8601String()),
|
|
);
|
|
}
|
|
}
|
|
|
|
class PersonalDietIsDefinedToCustomerNotification implements BaseNotificationModel {
|
|
@override
|
|
final NotificationType type;
|
|
@override
|
|
final bool isRead;
|
|
@override
|
|
final DateTime createdAt;
|
|
final String dietName;
|
|
final int dietId;
|
|
|
|
PersonalDietIsDefinedToCustomerNotification({
|
|
required this.type,
|
|
required this.isRead,
|
|
required this.createdAt,
|
|
required this.dietName,
|
|
required this.dietId,
|
|
});
|
|
|
|
factory PersonalDietIsDefinedToCustomerNotification.fromJson(Map<String, dynamic> json, NotificationType type, {bool? isRead, String? createdAt}) {
|
|
return PersonalDietIsDefinedToCustomerNotification(
|
|
type: type,
|
|
isRead: isRead ?? false,
|
|
createdAt: parseDate(createdAt ?? json['created_at'] ?? DateTime.now().toIso8601String()),
|
|
dietName: json['diet_name'] ?? '',
|
|
dietId: json['diet_id'],
|
|
);
|
|
}
|
|
}
|
|
|
|
enum NotificationType {
|
|
// Diet related
|
|
dietCancelled,
|
|
dietStarted,
|
|
dietExpired,
|
|
dietWillStartedIn,
|
|
dietCanNotBeStarted,
|
|
|
|
// Plan related
|
|
personalDietCreationNeeded,
|
|
chosenPlanClientLastDayFinished,
|
|
chosenPlanConsultantLastDayStarted,
|
|
chosenPlanClientLastDayStarted,
|
|
stayOnTrackToAuthor,
|
|
chosenPlanStartedToClient,
|
|
clientStartPlanSubscriptionToSubscriber,
|
|
consultantConfirmPlanSubscriptionToSubscriber,
|
|
clientPaidPlanSubscriptionToAuthor,
|
|
chosenPlanTomorrowReminderToClient,
|
|
chosenPlanTomorrowReminderToConsultant,
|
|
chosenPlanStartedToConsultant,
|
|
consultantLeftDiaryComment,
|
|
chosenPlanFinishedToClient,
|
|
consultantConfirmPlanSubscriptionToAuthor,
|
|
clientPaidPlanSubscriptionToSubscriber,
|
|
clientStartPlanSubscriptionToAuthor,
|
|
clientCancelPlanSubscriptionToAuthor,
|
|
clientCancelPlanSubscriptionToSubscriber,
|
|
userDailyReportCompleted,
|
|
chosenPlanFinishedToConsultant,
|
|
stayOnTrackToCustomer,
|
|
personalDietIsDefinedToCustomer,
|
|
|
|
// Comments
|
|
entityCommented,
|
|
commentReplied,
|
|
|
|
// Profile
|
|
phoneChanged,
|
|
|
|
// Subscription
|
|
subscription,
|
|
|
|
// Badges
|
|
badgeAwarded,
|
|
badgeRevoked,
|
|
|
|
// Consultant
|
|
consultantRequestStarted,
|
|
|
|
// Complaints
|
|
clientCloseComplaintSuccess,
|
|
complaintToModerationForUser,
|
|
|
|
// Finance
|
|
clientRefundSuccess,
|
|
consultantRefundSuccess,
|
|
clientRejectSuccess,
|
|
consultantRejectSuccess,
|
|
|
|
// Score
|
|
scoreAdded,
|
|
scoreSubstracted,
|
|
|
|
// Product
|
|
productStatusUpdatedForAuthor,
|
|
|
|
// Diary
|
|
diaryReminderForUsers,
|
|
|
|
// Legacy types (keeping for backward compatibility)
|
|
planSubscriptionStartedToAuthor,
|
|
planSubscriptionCanceledToAuthor,
|
|
chosenPlanStartedToClientNotification,
|
|
chosenPlanTomorrowReminderToClientNotification,
|
|
diaryReminderNotification,
|
|
consultantLeftComment,
|
|
personalizedDietIsDefined,
|
|
planSubscriptionCanceledToCustomer,
|
|
chosenPlanStartedToConsultantNotification,
|
|
chosenPlanTomorrowReminderToConsultantNotification,
|
|
planSubscriptionPaidToAuthor,
|
|
chosenPlanLastDayFinishedForUser,
|
|
planSubscriptionExpired,
|
|
planSubscriptionRenewed,
|
|
consultantAssigned,
|
|
consultantUnassigned,
|
|
paymentFailed,
|
|
paymentSuccessful,
|
|
goalAchieved,
|
|
workoutReminder,
|
|
mealReminder,
|
|
unknown;
|
|
|
|
static NotificationType getTypeFromString(String type) => switch (type) {
|
|
// New type-based mapping
|
|
'diet-cancelled' => NotificationType.dietCancelled,
|
|
'entity-commented' => NotificationType.entityCommented,
|
|
'comment-replied' => NotificationType.commentReplied,
|
|
'phone-changed' => NotificationType.phoneChanged,
|
|
'diet-started' => NotificationType.dietStarted,
|
|
'personal-diet-creation-needed-to-author' => NotificationType.personalDietCreationNeeded,
|
|
'chosen-plan-client-last-day-finished' => NotificationType.chosenPlanClientLastDayFinished,
|
|
'chosen-plan-consultant-last-day-started' => NotificationType.chosenPlanConsultantLastDayStarted,
|
|
'chosen-plan-client-last-day-started' => NotificationType.chosenPlanClientLastDayStarted,
|
|
'subscription' => NotificationType.subscription,
|
|
'badge-awarded' => NotificationType.badgeAwarded,
|
|
'badge-revoked' => NotificationType.badgeRevoked,
|
|
'diet-expired' => NotificationType.dietExpired,
|
|
'consultant-request-started' => NotificationType.consultantRequestStarted,
|
|
'diet-will-started-in' => NotificationType.dietWillStartedIn,
|
|
'client-close-complaint-success' => NotificationType.clientCloseComplaintSuccess,
|
|
'complaint-to-moderation-for-user' => NotificationType.complaintToModerationForUser,
|
|
'client-refund-success' => NotificationType.clientRefundSuccess,
|
|
'consultant-refund-success' => NotificationType.consultantRefundSuccess,
|
|
'client-reject-success' => NotificationType.clientRejectSuccess,
|
|
'consultant-reject-success' => NotificationType.consultantRejectSuccess,
|
|
'score-added' => NotificationType.scoreAdded,
|
|
'score-substracted' => NotificationType.scoreSubstracted,
|
|
'product-status-updated-for-author' => NotificationType.productStatusUpdatedForAuthor,
|
|
'diet-can-not-started' => NotificationType.dietCanNotBeStarted,
|
|
'stay-on-track-to-author' => NotificationType.stayOnTrackToAuthor,
|
|
'chosen-plan-started-to-client' => NotificationType.chosenPlanStartedToClient,
|
|
'client-start-plan-subscription-to-subscriber' => NotificationType.clientStartPlanSubscriptionToSubscriber,
|
|
'consultant-confirm-plan-subscription-to-subscriber' => NotificationType.consultantConfirmPlanSubscriptionToSubscriber,
|
|
'client-paid-plan-subscription-to-author' => NotificationType.clientPaidPlanSubscriptionToAuthor,
|
|
'chosen-plan-tomorrow-reminder-to-client' => NotificationType.chosenPlanTomorrowReminderToClient,
|
|
'chosen-plan-tomorrow-reminder-to-consultant' => NotificationType.chosenPlanTomorrowReminderToConsultant,
|
|
'chosen-plan-started-to-consultant' => NotificationType.chosenPlanStartedToConsultant,
|
|
'consultant-left-diary-comment' => NotificationType.consultantLeftDiaryComment,
|
|
'chosen-plan-finished-to-client' => NotificationType.chosenPlanFinishedToClient,
|
|
'consultant-confirm-plan-subscription-to-author' => NotificationType.consultantConfirmPlanSubscriptionToAuthor,
|
|
'client-paid-plan-subscription-to-subscriber' => NotificationType.clientPaidPlanSubscriptionToSubscriber,
|
|
'client-start-plan-subscription-to-author' => NotificationType.clientStartPlanSubscriptionToAuthor,
|
|
'client-cancel-plan-subscription-to-author' => NotificationType.clientCancelPlanSubscriptionToAuthor,
|
|
'client-cancel-plan-subscription-to-subscriber' => NotificationType.clientCancelPlanSubscriptionToSubscriber,
|
|
'user-daily-report-completed' => NotificationType.userDailyReportCompleted,
|
|
'chosen-plan-finished-to-consultant' => NotificationType.chosenPlanFinishedToConsultant,
|
|
'stay-on-track-to-customer' => NotificationType.stayOnTrackToCustomer,
|
|
'diary-reminder-for-users' => NotificationType.diaryReminderForUsers,
|
|
'personal-diet-is-defined-to-customer' => NotificationType.personalDietIsDefinedToCustomer,
|
|
|
|
// Legacy mapping
|
|
'App\\Notifications\\Plan\\PlanSubscriptionStartedToAuthor' => NotificationType.planSubscriptionStartedToAuthor,
|
|
'App\\Notifications\\Plan\\PlanSubscriptionCanceledToAuthor' => NotificationType.planSubscriptionCanceledToAuthor,
|
|
'App\\Notifications\\Plan\\ChosenPlanStartedToClientNotification' => NotificationType.chosenPlanStartedToClientNotification,
|
|
'App\\Notifications\\Plan\\ChosenPlanTomorrowReminderToClientNotification' => NotificationType.chosenPlanTomorrowReminderToClientNotification,
|
|
'App\\Notifications\\DiaryReminderNotification' => NotificationType.diaryReminderNotification,
|
|
'App\\Notifications\\Plan\\ConsultantLeftComment' => NotificationType.consultantLeftComment,
|
|
'App\\Notifications\\Plan\\PersonalizedDietIsDefined' => NotificationType.personalizedDietIsDefined,
|
|
'App\\Notifications\\Plan\\ChosenPlanFinishedToClient' => NotificationType.chosenPlanFinishedToClient,
|
|
'App\\Notifications\\Plan\\PlanSubscriptionCanceledToCustomer' => NotificationType.planSubscriptionCanceledToCustomer,
|
|
'App\\Notifications\\Plan\\ChosenPlanStartedToConsultantNotification' => NotificationType.chosenPlanStartedToConsultantNotification,
|
|
'App\\Notifications\\Plan\\ChosenPlanTomorrowReminderToConsultantNotification' => NotificationType.chosenPlanTomorrowReminderToConsultantNotification,
|
|
'App\\Notifications\\Plan\\PlanSubscriptionPaidToAuthor' => NotificationType.planSubscriptionPaidToAuthor,
|
|
'App\\Notifications\\Plan\\ChosenPlanFinishedToConsultant' => NotificationType.chosenPlanFinishedToConsultant,
|
|
'App\\Notifications\\ChosenPlan\\LastDayFinishedForUser' => NotificationType.chosenPlanLastDayFinishedForUser,
|
|
'App\\Notifications\\ChosenPlan\\LastDayStartedForConsultant' => NotificationType.chosenPlanConsultantLastDayStarted,
|
|
'App\\Notifications\\ComplaintToModerationNotify' => NotificationType.complaintToModerationForUser,
|
|
'App\\Notifications\\Comment\\Replied' => NotificationType.commentReplied,
|
|
'App\\Notifications\\Score\\ScoreAdded' => NotificationType.scoreAdded,
|
|
'App\\Notifications\\Comment\\EntityCommented' => NotificationType.entityCommented,
|
|
'App\\Notifications\\Plan\\PlanSubscriptionExpired' => NotificationType.planSubscriptionExpired,
|
|
'App\\Notifications\\Plan\\PlanSubscriptionRenewed' => NotificationType.planSubscriptionRenewed,
|
|
'App\\Notifications\\Plan\\ConsultantAssigned' => NotificationType.consultantAssigned,
|
|
'App\\Notifications\\Plan\\ConsultantUnassigned' => NotificationType.consultantUnassigned,
|
|
'App\\Notifications\\Payment\\PaymentFailed' => NotificationType.paymentFailed,
|
|
'App\\Notifications\\Payment\\PaymentSuccessful' => NotificationType.paymentSuccessful,
|
|
'App\\Notifications\\Goal\\GoalAchieved' => NotificationType.goalAchieved,
|
|
'App\\Notifications\\Workout\\WorkoutReminder' => NotificationType.workoutReminder,
|
|
'App\\Notifications\\Meal\\MealReminder' => NotificationType.mealReminder,
|
|
_ => NotificationType.unknown,
|
|
};
|
|
}
|
|
|
|
DateTime parseDate(String date) => DateTime.parse(date).toLocal();
|