prasule/lib/api/debt_scenario.dart

40 lines
993 B
Dart
Raw Normal View History

2024-07-17 16:44:02 +02:00
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<String, dynamic> json) =>
_$DebtScenarioFromJson(json);
/// Converts the data in this instance into a Map
Map<String, dynamic> toJson() => _$DebtScenarioToJson(this);
/// Unique identified
final int id;
/// User-friendly identifier
String name;
/// Whether this scenario should be shown under archived ones
bool isArchived;
/// All entries
List<DebtEntry> entries;
/// All people
List<DebtPerson> people;
}