[
    {
        "id": "pre_load",
        "workflow": [
            {
                "id": "1",
                "type": "start",
                "next": {
                    "success": "js"
                }
            },
            {
                "id": "js",
                "type": "js",
                "code": "function(data, ui){ui.formFields = window.UIJSON.{{route.params.entity}}.fields; ui.buttons = window.UIJSON.{{route.params.entity}}.buttons}",
                "next": {
                    "success": "exit"
                }
            }
        ]
    },
    {
        "id": "pre_load_entity",
        "workflow": [
            {
                "id": "1",
                "type": "start",
                "next": {
                    "success": "js"
                }
            },
            {
                "id": "js",
                "type": "js",
                "code": "function(data, ui){ui.formFields = window.UIJSON[ui.workflow_params.entity].fields; ui.buttons = window.UIJSON[ui.workflow_params.entity].buttons}",
                "next": {
                    "success": "exit"
                }
            }
        ]
    },
    {
        "id": "pre_load_edit",
        "workflow": [
            {
                "id": "1",
                "type": "start",
                "next": {
                    "success": "js"
                }
            },
            {
                "id": "js",
                "type": "js",
                "code": "function(data, ui){  ui.formFields = window.UIJSON.{{route.params.entity}}.fields; ui.buttons = window.UIJSON.{{route.params.entity}}.buttons}",
                "next": {
                    "success": "ajax"
                }
            },
            {
                "id": "ajax",
                "type": "ajax",
                "method": "get",
                "data": "{}",
                "url": "{{#with (lookup ui_json route.params.entity)}}{{get}}{{/with}}/{{route.params.id}}",
                "var": "response_data",
                "headers": "{{route.params.entity}}",
                "next": {
                    "success": "deserialize_form",
                    "failure": "bad-alert"
                }
            },
            {
                "id": "deserialize_form",
                "type": "deserialize_form",
                "data": "{{{json response_data.data}}}",
                "next": {
                    "success": "exit"
                }
            }
        ]
    }
]