Files
sendico/frontend/pshared/lib/data/dto/ledger/account.dart
2026-01-30 16:54:56 +01:00

54 lines
1.7 KiB
Dart

import 'package:json_annotation/json_annotation.dart';
import 'package:pshared/data/dto/describable.dart';
import 'package:pshared/data/dto/ledger/balance.dart';
import 'package:pshared/data/dto/ledger/role.dart';
import 'package:pshared/data/dto/ledger/status.dart';
import 'package:pshared/data/dto/ledger/type.dart';
part 'account.g.dart';
@JsonSerializable(includeIfNull: false, explicitToJson: true)
class LedgerAccountDTO {
final String ledgerAccountRef;
final String organizationRef;
final String? ownerRef;
final String accountCode;
@JsonKey(fromJson: ledgerAccountTypeFromJson, toJson: ledgerAccountTypeToJson)
final LedgerAccountTypeDTO accountType;
final String currency;
@JsonKey(fromJson: ledgerAccountStatusFromJson, toJson: ledgerAccountStatusToJson)
final LedgerAccountStatusDTO status;
final bool allowNegative;
@JsonKey(fromJson: ledgerAccountRoleFromJson, toJson: ledgerAccountRoleToJson)
final LedgerAccountRoleDTO role;
final Map<String, String>? metadata;
final DateTime? createdAt;
final DateTime? updatedAt;
final DescribableDTO? describable;
final LedgerBalanceDTO? balance;
const LedgerAccountDTO({
required this.ledgerAccountRef,
required this.organizationRef,
this.ownerRef,
required this.accountCode,
required this.accountType,
required this.currency,
required this.status,
required this.allowNegative,
required this.role,
this.metadata,
this.createdAt,
this.updatedAt,
this.describable,
this.balance,
});
factory LedgerAccountDTO.fromJson(Map<String, dynamic> json) => _$LedgerAccountDTOFromJson(json);
Map<String, dynamic> toJson() => _$LedgerAccountDTOToJson(this);
}