{
  "name": "Make switch() - exact matches and fallback example",
  "flow": [
    {
      "id": 1,
      "module": "json:ParseJSON",
      "version": 1,
      "parameters": {
        "type": ""
      },
      "mapper": {
        "json": "[{\"case\":\"paid\",\"status\":\"paid\",\"expected\":\"ready\"},{\"case\":\"pending\",\"status\":\"pending\",\"expected\":\"wait\"},{\"case\":\"unknown\",\"status\":\"cancelled\",\"expected\":\"review\"},{\"case\":\"blank\",\"status\":\"\",\"expected\":\"review\"},{\"case\":\"missing\",\"expected\":\"review\"},{\"case\":\"null\",\"status\":null,\"expected\":\"review\"}]"
      },
      "metadata": {
        "designer": {
          "x": 0,
          "y": 0,
          "name": "Six synthetic status inputs"
        },
        "restore": {
          "parameters": {
            "type": {
              "label": "Choose a data structure"
            }
          }
        },
        "parameters": [
          {
            "name": "type",
            "type": "udt",
            "label": "Data structure"
          }
        ],
        "expect": [
          {
            "name": "json",
            "type": "text",
            "label": "JSON string",
            "required": true
          }
        ]
      }
    },
    {
      "id": 2,
      "module": "util:SetVariables",
      "version": 1,
      "parameters": {},
      "mapper": {
        "scope": "roundtrip",
        "variables": [
          {
            "name": "outcome",
            "value": "{{switch(ifempty(1.status; \"__MISSING__\"); \"paid\"; \"ready\"; \"pending\"; \"wait\"; \"review\")}}"
          }
        ]
      },
      "metadata": {
        "designer": {
          "x": 300,
          "y": 0,
          "name": "Match status or use fallback"
        },
        "interface": [
          {
            "name": "outcome",
            "label": "outcome",
            "type": "any"
          }
        ]
      }
    },
    {
      "id": 3,
      "module": "util:SetVariables",
      "version": 1,
      "parameters": {},
      "mapper": {
        "scope": "roundtrip",
        "variables": [
          {
            "name": "case",
            "value": "{{1.case}}"
          },
          {
            "name": "input",
            "value": "{{ifempty(1.status; \"MISSING\")}}"
          },
          {
            "name": "expected",
            "value": "{{1.expected}}"
          },
          {
            "name": "actual",
            "value": "{{2.outcome}}"
          },
          {
            "name": "passed",
            "value": "{{2.outcome = 1.expected}}"
          }
        ]
      },
      "metadata": {
        "designer": {
          "x": 600,
          "y": 0,
          "name": "Check actual against expected"
        },
        "interface": [
          {
            "name": "case",
            "label": "case",
            "type": "any"
          },
          {
            "name": "input",
            "label": "input",
            "type": "any"
          },
          {
            "name": "expected",
            "label": "expected",
            "type": "any"
          },
          {
            "name": "actual",
            "label": "actual",
            "type": "any"
          },
          {
            "name": "passed",
            "label": "passed",
            "type": "any"
          }
        ]
      }
    }
  ],
  "metadata": {
    "instant": false,
    "version": 1,
    "scenario": {
      "roundtrips": 1,
      "maxErrors": 3,
      "autoCommit": true,
      "autoCommitTriggerLast": true,
      "sequential": false,
      "slots": null,
      "confidential": false,
      "dataloss": false,
      "dlq": false,
      "freshVariables": false
    },
    "designer": {
      "orphans": []
    },
    "zone": "eu1.make.com",
    "notes": []
  }
}
