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 json) => _$LedgerBalanceDTOFromJson(json); Map toJson() => _$LedgerBalanceDTOToJson(this); }