forked from eatvio/eatvio_app
40 lines
1.8 KiB
Dart
40 lines
1.8 KiB
Dart
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);
|
|
}
|