import 'package:smoke_cess_app/services/json_service.dart'; class Settings { final int group; final List? relapseCategories; final QueryConfig? moodQuery; final QueryConfig? sleepQuery; final TimeConfig? chessTime; final DateTime startedAt; Settings(this.group, this.relapseCategories, this.moodQuery, this.sleepQuery, this.chessTime, this.startedAt); Settings.fromJson(Map json) : group = json['group'] as int, relapseCategories = jsonPropertyAsList(json['relapse_categories']), moodQuery = QueryConfig.fromJson(json['mood_query']), sleepQuery = QueryConfig.fromJson(json['sleep_query']), chessTime = json['chess_time'] != null ? TimeConfig.fromJson(json['chess_time']) : null, startedAt = DateTime.now(); } class QueryConfig { final int? hours; final int? minutes; final List? days; QueryConfig(this.hours, this.minutes, this.days); QueryConfig.fromJson(Map json) : hours = json['hours'] as int, minutes = json['minutes'] as int, days = jsonPropertyAsList(json['days']); } class TimeConfig { final int? hours; final int? minutes; TimeConfig(this.hours, this.minutes); TimeConfig.fromJson(Map json) : hours = json['hours'] as int, minutes = json['minutes'] as int; }