2023-09-08 11:50:21 +02:00
|
|
|
import 'package:prasule/api/category.dart';
|
|
|
|
import 'package:json_annotation/json_annotation.dart';
|
2023-10-09 17:28:05 +02:00
|
|
|
import 'package:prasule/api/entry_data.dart';
|
|
|
|
part 'walletentry.g.dart';
|
2023-09-08 11:50:21 +02:00
|
|
|
|
|
|
|
@JsonSerializable()
|
2023-10-09 17:28:05 +02:00
|
|
|
|
|
|
|
/// This is an entry containing a single item
|
|
|
|
class WalletSingleEntry {
|
2023-09-08 11:50:21 +02:00
|
|
|
EntryType type;
|
2023-10-09 17:28:05 +02:00
|
|
|
EntryData data;
|
2023-09-08 11:50:21 +02:00
|
|
|
DateTime date;
|
|
|
|
WalletCategory category;
|
2023-09-14 19:44:34 +02:00
|
|
|
int id;
|
2023-09-08 11:50:21 +02:00
|
|
|
|
2023-10-09 17:28:05 +02:00
|
|
|
WalletSingleEntry(
|
|
|
|
{required this.data,
|
2023-09-08 11:50:21 +02:00
|
|
|
required this.type,
|
|
|
|
required this.date,
|
2023-09-14 19:44:34 +02:00
|
|
|
required this.category,
|
|
|
|
required this.id});
|
2023-09-08 11:50:21 +02:00
|
|
|
|
|
|
|
/// Connect the generated [_$WalletEntry] function to the `fromJson`
|
|
|
|
/// factory.
|
2023-10-09 17:28:05 +02:00
|
|
|
factory WalletSingleEntry.fromJson(Map<String, dynamic> json) =>
|
|
|
|
_$WalletSingleEntryFromJson(json);
|
2023-09-08 11:50:21 +02:00
|
|
|
|
2023-09-14 19:44:34 +02:00
|
|
|
/// Connect the generated [_$WalletEntryToJson] function to the `toJson` method.
|
2023-10-09 17:28:05 +02:00
|
|
|
Map<String, dynamic> toJson() => _$WalletSingleEntryToJson(this);
|
2023-09-08 11:50:21 +02:00
|
|
|
}
|