<?xml version="1.0" encoding="UTF-8"?>
<!--
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
-->
<!-- 
This is to test transitions with guard conditions, and multiple
transitions originating from the same state. 
-->
<scxml 
    datamodel="ecmascript"
    xmlns="http://www.w3.org/2005/07/scxml"
    version="1.0"
    name="root">

    <!-- default transition -->
    <state id="a">
        <transition target="b"/>
    </state>

    <!-- regular transition -->
    <state id="b">
        <transition target="c" event="t1"/>
    </state>

    <!-- two default transitions, first should get priority (based on document order), end in d1 -->
    <state id="c">
        <transition target="d1"/>
        <transition target="d2"/>
    </state>

    <!-- two regular transitions, first should get priority, end in e1 -->
    <state id="d1">
        <transition target="e1" event="t2"/>
        <transition target="e2" event="t2"/>
    </state>

    <state id="d2"/>

    <!-- two transitions with guard conditions; 
        first has priority, but will fail, so second transition should be taken,
        end in f2 -->
    <state id="e1">
        <transition target="f1" event="t3" cond="false"/>
        <transition target="f2" event="t3" cond="true"/>
    </state>

    <state id="e2"/>

    <state id="f1"/>

    <!-- like above, but with three transitions -->
    <state id="f2">
        <transition target="g1" event="t4" cond="false"/>
        <transition target="g2" event="t4" cond="false"/>
        <transition target="g3" event="t4" cond="true"/>
    </state>

    <state id="g1"/>

    <state id="g2"/>

    <state id="g3">

        <initial>
            <transition target="h"/>
        </initial>

        <!-- this one should pass -->
        <state id="h">
            <transition target="i" event="t5" cond="true"/>
        </state>

        <!-- this one should not pass, and the outer transition should be taken -->
        <state id="i">
            <transition target="j" event="t5" cond="false"/>
        </state>

        <state id="j"/>

        <transition target="last" event="t5" cond="true"/>
    </state>

    <state id="last"/>
</scxml>


