rluv_client/lib/models/budget_category_model.dart

44 lines
977 B
Dart
Raw Normal View History

2023-07-19 02:16:13 -06:00
import 'dart:ui';
import 'package:json_annotation/json_annotation.dart';
import '../global/utils.dart';
part 'budget_category_model.g.dart';
@JsonSerializable()
class BudgetCategory {
const BudgetCategory({
this.id,
required this.budgetId,
required this.name,
required this.color,
2023-07-22 21:29:32 -06:00
this.createdAt,
this.updatedAt,
2023-07-19 02:16:13 -06:00
required this.amount,
2023-07-22 21:29:32 -06:00
this.hide = false,
2023-07-19 02:16:13 -06:00
});
final int budgetId;
final int? id;
final String name;
final double amount;
2023-07-22 21:29:32 -06:00
@JsonKey(fromJson: boolFromJson, toJson: boolToJson)
final bool hide;
2023-07-19 02:16:13 -06:00
@JsonKey(fromJson: colorFromJson, toJson: colorToJson)
final Color color;
@JsonKey(fromJson: dateFromJson, toJson: dateToJson)
2023-07-22 21:29:32 -06:00
final DateTime? createdAt;
@JsonKey(fromJson: dateFromJson, toJson: dateToJson)
final DateTime? updatedAt;
2023-07-19 02:16:13 -06:00
factory BudgetCategory.fromJson(Map<String, dynamic> json) =>
_$BudgetCategoryFromJson(json);
Map<String, dynamic> toJson() => _$BudgetCategoryToJson(this);
}