const String transactionTableName = 'transactions';
const String transactionColumnId = 'id';
const String transactionColumnUuid = 'uuid';
const String transactionColumnType = 'type';
const String transactionColumnStatus = 'status';
const String transactionColumnData = 'data';
const String transactionColumnAppCompanyId = 'appCompanyId';
const String transactionColumnCreatedAt = 'createdAt';
const String transactionColumnUpdatedAt = 'updatedAt';

const int transactionTypeSell = 1;
const int transactionTypeBuy = 2;
const int transactionTypeReturnSell = 3;

const int transactionStatusPrepare = 0;
const int transactionStatusFinish = 7;


class Transaction {

  Transaction();

  Transaction.fromMap(Map<String, dynamic> map) {
    id = map[transactionColumnId] as int;
    uuid = map[transactionColumnUuid] as String;
    type = map[transactionColumnType] as int;
    status = map[transactionColumnStatus] as int;
    appCompanyId = map[transactionColumnAppCompanyId] as int;
    data = map[transactionColumnData] as String;
    createdAt = map[transactionColumnCreatedAt] as String;
    updatedAt = map[transactionColumnUpdatedAt] as String;
  }

  int? id;
  String? uuid;
  int? type;
  int? status;
  String? data;
  int? appCompanyId;
  String? createdAt;
  String? updatedAt;

  Map<String, dynamic> toMap() {
    final Map<String, dynamic> map = <String, dynamic>{
      transactionColumnUuid: uuid,
      transactionColumnType: type,
      transactionColumnStatus: status,
      transactionColumnData: data,
      transactionColumnAppCompanyId: appCompanyId,
      transactionColumnCreatedAt: createdAt,
      transactionColumnUpdatedAt: updatedAt,
    };
    if (id != null) {
      map[transactionColumnId] = id;
    }
    return map;
  }


}

