build method

HashMap<String, String> build()

Implementation

HashMap<String, String> build() {
  // All key/values
  final buildMap = HashMap<String, String>();
  for (final item in _map.entries) {
    final value = item.value;
    if (value != null) {
      buildMap[item.key] = Helper.encodeValue(value);
    }
  }

  // Product action
  final productAction = _productAction;
  if (productAction != null) {
    buildMap.addAll(productAction.build());
  }

  // Promotion
  _promotions.asMap().forEach((index, value) {
    buildMap.addAll(value.build(ZZD.zzj(index + 1)));
  });

  // Products
  _products.asMap().forEach((index, value) {
    buildMap.addAll(value.build(ZZD.zzh(index + 1)));
  });

  // Product impressions
  var impressionIndex = 1;
  for (final productImpession in _productImpressions.entries) {
    final impressionPrefix = ZZD.zzm(impressionIndex);
    productImpession.value.asMap().forEach((index, product) {
      final productPrefix = impressionPrefix + ZZD.zzl(index + 1);
      buildMap.addAll(product.build(productPrefix));
    });
    final impressionKey = impressionPrefix + "nm";
    buildMap[impressionKey] = productImpession.key;
    impressionIndex += 1;
  }

  return buildMap;
}