28 lines
702 B
Dart
28 lines
702 B
Dart
import 'package:json_annotation/json_annotation.dart';
|
|
|
|
import 'package:pshared/data/dto/money.dart';
|
|
|
|
part 'balance.g.dart';
|
|
|
|
|
|
@JsonSerializable(
|
|
includeIfNull: false, // <- omitempty behavior
|
|
explicitToJson: true, // <- nested DTOs call toJson()
|
|
)
|
|
class LedgerBalanceDTO {
|
|
final String ledgerAccountRef;
|
|
final MoneyDTO? balance;
|
|
final int version;
|
|
final DateTime? lastUpdated;
|
|
|
|
const LedgerBalanceDTO({
|
|
required this.ledgerAccountRef,
|
|
this.balance,
|
|
required this.version,
|
|
this.lastUpdated,
|
|
});
|
|
|
|
factory LedgerBalanceDTO.fromJson(Map<String, dynamic> json) => _$LedgerBalanceDTOFromJson(json);
|
|
Map<String, dynamic> toJson() => _$LedgerBalanceDTOToJson(this);
|
|
}
|