prasule/lib/api/walletentry.dart

41 lines
954 B
Dart
Raw Normal View History

2023-09-08 11:50:21 +02:00
import 'package:json_annotation/json_annotation.dart';
import 'package:prasule/api/category.dart';
import 'package:prasule/api/entry_data.dart';
part 'walletentry.g.dart';
2023-09-08 11:50:21 +02:00
@JsonSerializable()
/// This is an entry containing a single item
class WalletSingleEntry {
/// This is an entry containing a single item
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
/// Connects generated fromJson function
factory WalletSingleEntry.fromJson(Map<String, dynamic> json) =>
_$WalletSingleEntryFromJson(json);
2023-09-08 11:50:21 +02:00
/// Expense or income
EntryType type;
/// Actual entry data
EntryData data;
/// Date of entry creation
DateTime date;
/// Selected category
WalletCategory category;
/// Unique entry ID
int id;
/// Connects generated toJson function
Map<String, dynamic> toJson() => _$WalletSingleEntryToJson(this);
2023-09-08 11:50:21 +02:00
}