import 'package:json_annotation/json_annotation.dart';

import '../global/utils.dart';

part 'budget.g.dart';

@JsonSerializable()
class Budget {
  const Budget({
    this.id,
    required this.familyId,
    required this.name,
    required this.expectedIncome,
    required this.createdAt,
    required this.updatedAt,
    this.hide = false,
  });

  final int? id;
  final int familyId;
  final double? expectedIncome;
  final String name;

  @JsonKey(fromJson: boolFromJson, toJson: boolToJson)
  final bool hide;
  @JsonKey(fromJson: dateFromJson, toJson: dateToJson)
  final DateTime createdAt;
  @JsonKey(fromJson: dateFromJson, toJson: dateToJson)
  final DateTime updatedAt;

  factory Budget.fromJson(Map<String, dynamic> json) => _$BudgetFromJson(json);

  Map<String, dynamic> toJson() => _$BudgetToJson(this);
}
