import 'package:pshared/data/dto/wallet/balance.dart';
import 'package:pshared/data/mapper/money.dart';
import 'package:pshared/models/wallet/balance.dart';


extension WalletBalanceDTOMapper on WalletBalanceDTO {
  WalletBalance toDomain() => WalletBalance(
    available: available?.toDomain(),
    pendingInbound: pendingInbound?.toDomain(),
    pendingOutbound: pendingOutbound?.toDomain(),
    calculatedAt: (calculatedAt == null || calculatedAt!.isEmpty)
      ? null
      : DateTime.tryParse(calculatedAt!),
  );
}
