{
  "name": "dialog/delivery_reliability2/delivery_reliability_map.json",
  "definition": {
    "day_difference": {
      "map": [
        ["if", ["sor_confirmed_delivery_date", ">", "1970-01-01"], [
          ["target_date", "=", "sor_confirmed_delivery_date"],
          ["day_difference", "=", ["dayDifference", ["sor_confirmed_delivery_date", "sor_delivery_date"]]]
        ], "elseif", ["sor_delivered_date", ">", "1970-01-01"], [
          ["target_date", "=", "sor_delivered_date"],
          ["day_difference", "=", ["dayDifference", ["sor_delivered_date", "sor_delivery_date"]]]
        ], "else", [
          ["target_date", "=", "sor_delivery_date"],
          ["day_difference", "=", 0],
          ["graph_warning", "=", ["concat", ["Error in sales order: ", "sor_sales_order_id", "#", "sor_row_number", ", delivery date = ", "sor_delivered_date", ", delivered date = ", "sor_delivery_date", ", confirmed delivery date = ", "sor_confirmed_delivery_date", ", delivery_state = ", "sor_delivery_state", ".<br/>"]]]
        ]]
      ]
    }
  }
}
