forked from eatvio/eatvio_app
feat(notifications): Issue-236
This commit is contained in:
39
lib/features/menu/models/notification_settings_model.dart
Normal file
39
lib/features/menu/models/notification_settings_model.dart
Normal file
@@ -0,0 +1,39 @@
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
part 'notification_settings_model.g.dart';
|
||||
part 'notification_settings_model.freezed.dart';
|
||||
|
||||
@freezed
|
||||
abstract class NotificationSettingsModel with _$NotificationSettingsModel {
|
||||
const factory NotificationSettingsModel({
|
||||
@JsonKey(name: 'new_updates_notification') required bool newUpdatesNotification,
|
||||
@JsonKey(name: 'weight_measurements_notification') required bool weightMeasurementsNotification,
|
||||
@JsonKey(name: 'is_email_notifications_enabled') required bool isEmailNotificationsEnabled,
|
||||
@JsonKey(name: 'is_push_notifications_enabled') required bool isPushNotificationsEnabled,
|
||||
@JsonKey(name: 'diary_reminder_notifications') required DiaryReminderNotifications diaryReminderNotifications,
|
||||
}) = _NotificationSettingsModel;
|
||||
|
||||
factory NotificationSettingsModel.fromJson(Map<String, Object?> json) => _$NotificationSettingsModelFromJson(json);
|
||||
}
|
||||
|
||||
@freezed
|
||||
abstract class DiaryReminderNotifications with _$DiaryReminderNotifications {
|
||||
const factory DiaryReminderNotifications({
|
||||
@JsonKey(name: 'first_reminder') required ReminderSettings firstReminder,
|
||||
@JsonKey(name: 'second_reminder') required ReminderSettings secondReminder,
|
||||
@JsonKey(name: 'third_reminder') required ReminderSettings thirdReminder,
|
||||
}) = _DiaryReminderNotifications;
|
||||
|
||||
factory DiaryReminderNotifications.fromJson(Map<String, Object?> json) => _$DiaryReminderNotificationsFromJson(json);
|
||||
}
|
||||
|
||||
@freezed
|
||||
abstract class ReminderSettings with _$ReminderSettings {
|
||||
const factory ReminderSettings({
|
||||
required bool enabled,
|
||||
@JsonKey(name: 'local_time_hours') required int localTimeHours,
|
||||
@JsonKey(name: 'local_time_mins') required int localTimeMins,
|
||||
}) = _ReminderSettings;
|
||||
|
||||
factory ReminderSettings.fromJson(Map<String, Object?> json) => _$ReminderSettingsFromJson(json);
|
||||
}
|
||||
Reference in New Issue
Block a user