import 'package:satu/core/models/flow/sell_response.dart';
import 'package:satu/core/utils/utils_parse.dart';

class TransactionData {
  TransactionData();

  TransactionData.fromMap(dynamic map) {
    contragentName = cast<String>(map['contragentName']) ?? '';
    card = cast<double>(map['card']) ?? 0;
    nal = cast<double>(map['nal']) ?? 0;
    total = cast<double>(map['total']) ?? 0;
    sellResponse = map['sellResponse'] != null
        ? SellResponse.fromMap(map['sellResponse'])
        : null;
  }

  String contragentName = '';
  double card = 0;
  double nal = 0;
  double total = 0;
  SellResponse? sellResponse;

  Map<String, dynamic> toMap() {
    final Map<String, dynamic> map = <String, dynamic>{
      'contragentName': contragentName,
      'card': card,
      'nal': nal,
      'total' : total,
      'sellResponse': sellResponse
    };
    return map;
  }
}
