<?xml version="1.0" encoding="UTF-8"?>
<process xmlns:blue="http://www.e-marson.com/bluelemon">

  <descriptor>
    <name>com/emarson/lemonade/examples/mobank/AuthenticationSucceeded</name>
    <version>1.0</version>
    <description>
      The following will happen after processing this code:
       - userId will be stored in the 'permanent' location,
       - STARTUP_INSTRUCTION will be updated so every time the 
         application is started user will be forwarded to MainScreen
       - user will be forwarded to MainScreen.
    </description>
    <vendor>E-MARSON</vendor>
  </descriptor>

  <arguments>
    <argument key="userId" type="String"/>  
  </arguments>

  <path>
  
    <!-- ASSOCIATIONS --->

    <!-- association to MainScreen --->
    <action name="go to the main screen">
      <type>general/bluelemon/code</type>
      <definition resultTo="goToMainScreen">
        <blue:call node="com/emarson/lemonade/examples/mobank/MainScreen"
                         location="@com/emarson/lemonade/examples/mobank"/>

      </definition>
    </action>
    
    
    <!-- INSTRUCTION --->
  
    <action name="success action">
      <type>general/bluelemon/code</type>
      <definition resultTo="result">

        <!-- store userId --->
        <blue:set node="com/emarson/lemonade/examples/mobank/UserId"
                  location="permanent">

          <blue:argument type="String" contextKey="userId"/>
        </blue:set>
        
        <!-- set the STARTUP_INSTRUCTION to go straight to the main screen --->
        <blue:set node="STARTUP_INSTRUCTION" location="permanent">
          <blue:argument type="byteArr" contextKey="goToMainScreen"/>
        </blue:set>
        
        <!-- go to the main screen --->
        <blue:call node="com/emarson/lemonade/examples/mobank/MainScreen"
                         location="@com/emarson/lemonade/examples/mobank"/>


      </definition>
    </action>

    <finish name="done">
      <return>result</return>
    </finish>

  </path>

</process>