import 'package:json_annotation/json_annotation.dart'; import 'package:prasule/api/debt_entry.dart'; import 'package:prasule/api/debt_person.dart'; part 'debt_scenario.g.dart'; /// A folder for different entries and people @JsonSerializable() class DebtScenario { /// A folder for different entries and people DebtScenario({ required this.id, required this.name, required this.isArchived, this.entries = const [], this.people = const [], }); /// Generates a class instance from a Map factory DebtScenario.fromJson(Map json) => _$DebtScenarioFromJson(json); /// Converts the data in this instance into a Map Map toJson() => _$DebtScenarioToJson(this); /// Unique identified @JsonKey(disallowNullValue: true) final int id; /// User-friendly identifier @JsonKey(defaultValue: "Unknown") String name; /// Whether this scenario should be shown under archived ones @JsonKey(defaultValue: false) bool isArchived; /// All entries @JsonKey(defaultValue: []) List entries; /// All people @JsonKey(defaultValue: _defaultPeopleList) List people; } List _defaultPeopleList() => [DebtPerson.unknownPerson()];