2023-09-08 11:50:21 +02:00
|
|
|
import 'package:prasule/api/category.dart';
|
|
|
|
import 'package:json_annotation/json_annotation.dart';
|
|
|
|
part 'entry.g.dart';
|
|
|
|
|
|
|
|
@JsonSerializable()
|
|
|
|
class WalletEntry {
|
|
|
|
EntryType type;
|
|
|
|
String name;
|
|
|
|
double amount;
|
|
|
|
DateTime date;
|
|
|
|
WalletCategory category;
|
2023-09-14 19:44:34 +02:00
|
|
|
int id;
|
2023-09-08 11:50:21 +02:00
|
|
|
|
|
|
|
WalletEntry(
|
|
|
|
{required this.name,
|
|
|
|
required this.amount,
|
|
|
|
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.
|
|
|
|
factory WalletEntry.fromJson(Map<String, dynamic> json) =>
|
|
|
|
_$WalletEntryFromJson(json);
|
|
|
|
|
2023-09-14 19:44:34 +02:00
|
|
|
/// Connect the generated [_$WalletEntryToJson] function to the `toJson` method.
|
2023-09-08 11:50:21 +02:00
|
|
|
Map<String, dynamic> toJson() => _$WalletEntryToJson(this);
|
|
|
|
}
|