2024-06-30 20:25:36 +02:00
|
|
|
// SPDX-FileCopyrightText: (C) 2024 Matyáš Caras
|
|
|
|
//
|
|
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
2023-10-09 17:28:05 +02:00
|
|
|
import 'package:json_annotation/json_annotation.dart';
|
|
|
|
part 'entry_data.g.dart';
|
|
|
|
|
2023-12-29 21:39:54 +01:00
|
|
|
/// Contains raw data
|
2023-10-09 17:28:05 +02:00
|
|
|
@JsonSerializable()
|
|
|
|
class EntryData {
|
2023-12-29 21:39:54 +01:00
|
|
|
/// Contains raw data
|
2023-11-01 17:58:05 +01:00
|
|
|
EntryData({required this.name, required this.amount, this.description = ""});
|
2023-10-09 17:28:05 +02:00
|
|
|
|
2024-07-17 16:44:02 +02:00
|
|
|
/// Generates a class instance from a Map
|
2023-10-09 17:28:05 +02:00
|
|
|
factory EntryData.fromJson(Map<String, dynamic> json) =>
|
|
|
|
_$EntryDataFromJson(json);
|
|
|
|
|
2023-12-29 21:39:54 +01:00
|
|
|
/// Name of entry
|
|
|
|
String name;
|
|
|
|
|
|
|
|
/// Optional description, default is empty
|
|
|
|
String description;
|
|
|
|
|
|
|
|
/// Amount for entry
|
|
|
|
double amount;
|
|
|
|
|
2024-07-17 16:44:02 +02:00
|
|
|
/// Converts the data in this instance into a Map
|
2023-10-09 17:28:05 +02:00
|
|
|
Map<String, dynamic> toJson() => _$EntryDataToJson(this);
|
|
|
|
}
|