prasule/lib/api/recurring_entry.dart

33 lines
951 B
Dart
Raw Normal View History

import 'package:json_annotation/json_annotation.dart';
import 'package:prasule/api/walletentry.dart';
import 'package:prasule/api/category.dart';
import 'package:prasule/api/entry_data.dart';
part 'recurring_entry.g.dart';
enum RecurringType { byDay, byMonth, byYear }
@JsonSerializable()
/// Used to store data about recurring entries
class RecurringEntry extends WalletSingleEntry {
/// Sets recurring by day, month or year
RecurringType recurringType;
/// Indicates by how many days/months/years should we recur
int recurEvery;
RecurringEntry(
{required super.data,
required super.type,
required super.date,
required super.category,
required super.id,
required this.recurringType,
required this.recurEvery});
factory RecurringEntry.fromJson(Map<String, dynamic> json) =>
_$RecurringEntryFromJson(json);
@override
Map<String, dynamic> toJson() => _$RecurringEntryToJson(this);
}