[
    {
      "init": {
        "assign": [
          {
            "textAndSourceLang": {
              "Hello": "en",
              "Ciao": "it",
              "Bonjour": "fr",
              "Auf wiedersehen": "de",
              "lkajshflkj": "unknown",
              "Goodbye": "en"
            }
          },
          {
            "allowedSourceLang": [
              "en",
              "de",
              "it",
              "fr"
            ]
          }
        ]
      }
    },
    {
      "translateToFrench": {
        "for": {
          "value": "text",
          "in": "${keys(textAndSourceLang)}",
          "steps": [
            {
              "verifySource": {
                "switch": [
                  {
                    "condition": "${not(textAndSourceLang[text] in allowedSourceLang)}",
                    "next": "continue"
                  },
                  {
                    "condition": "${textAndSourceLang[text] == \"fr\"}",
                    "next": "skipFrench"
                  }
                ],
                "next": "translate"
              }
            },
            {
              "skipFrench": {
                "assign": [
                  {
                    "fr_translation": "${text}"
                  }
                ],
                "next": "printFrench"
              }
            },
            {
              "translate": {
                "call": "http.get",
                "args": {
                  "url": "${\"http://localhost:1234/translate?q=\" + text + \"&target=fr&format=text&source=\" + textToTranslate[text]}"
                },
                "result": "translation",
                "next": "print"
              }
            },
            {
              "print": {
                "call": "sys.log",
                "args": {
                  "text": "${\"original: \" + text + \", translation: \" + translation.body}"
                },
                "next": "continue"
              }
            },
            {
              "printFrench": {
                "call": "sys.log",
                "args": {
                  "text": "${\"original: \" + text + \", translation: \" + fr_translation}"
                },
                "next": "continue"
              }
            }
          ]
        }
      }
    }
]