<?xml version="1.0" encoding="UTF-8"?>
<ae:configurations xmlns:ae="http://agavi.org/agavi/config/global/envelope/1.0"
    xmlns="http://icinga.org/appkit/config/parts/routing/1.0">
    <ae:configuration context="web">
        <routes>

            <!-- * Icinga routes (Web module) -->
            <route name=".icinga" pattern="^/web" module="Web" stop="true">

                <!-- Icinga index route -->
                <route name=".home" pattern="^$" action="Index" />
                <route name=".about" pattern="^/about$" action="Icinga.Help"
                    output_type="html" />

                <!-- The main view -->
                <route name=".portalView" pattern="^/portal$" action="Icinga.PortalView" />

                <route name=".customPortal" pattern="^/customPortal" action="Icinga.PortalView"
                    stop="true">

                    <route name=".crbase" pattern="/cr_base=(cr_base:[^/]*)"
                        stop="false" />
                    <route name=".groupDir" pattern="/groupDir=(groupDir:(ASC|DESC))"
                        stop="false" />
                    <route name=".groupField" pattern="/groupField=(groupField:[^/]*)"
                        stop="false" />
                    <route name=".sortDir" pattern="/sortDir=(sortDir:(ASC|DESC))"
                        stop="false" />
                    <route name=".sortField" pattern="/sortField=(sortField:[^/]*)"
                        stop="false" />
                    <route name=".iconCls" pattern="/iconCls=(iconCls:[^/]*)"
                        stop="false" />
                    <route name=".template" pattern="/template=(template:[^/]*)"
                        stop="false" />
                    <route name=".crname" pattern="/crname=(crname:[^/]*)" stop="false" />
                    <route name=".title" pattern="/title=(title:[^/]*)" stop="false" />

                </route>

                <!-- TestPage -->
                <route name=".testPage" pattern="^/testpage$" action="Icinga.TestPage" />

                <!-- Simpleprovider for popups -->
                <route name=".simpleDataProvider" pattern="^/simpleDataProvider"
                    output_type="json">
                    <route name=".json" pattern="^/json" action="Icinga.ApiSimpleDataProvider" />
                </route>
                <route module="Api" name=".api" pattern="^/api" action="ApiSearch">
                    <route name=".dataStore" output_type="html" stop="true"
                        pattern="^/dataStore" action="ApiDataStoreProvider" api_provider="true" />
                    <route name=".icingaStatus" output_type="json" stop="false"
                        pattern="^/icinga/statusProvider" action="IcingaInstanceController" />
                    <route name=".command" stop="false" pattern="^/cmd/"
                        output_type="json" action="ApiCommand">
                        <route name=".cmdParam" stop="false" pattern="cmd=(command:[^/]*)/" />
                        <route name=".authkey" stop="false" pattern="authkey=(authkey:[^/]*)" />
                        <route name=".data" stop="false" pattern="data=(data:[^/]*)" />
                        <route name=".target" stop="false" pattern="target=(target:[^/]*)" />
                    </route>
                    <route name=".target" stop="false"
                        pattern="^/(target:instance|host|service|hostgroup|servicegroup|customvariable|contact|contactgroup|timeperiod|hoststatus|servicestatus|hosttimes|servicetimes|config|program|log|host_status_summary|service_status_summary|host_status_history|service_status_history|host_parents|notifications|hostgroup_summary|servicegroup_summary|command|downtime|comment|hostcomment|servicecomment|status|host_service)/">
                        <!-- Filter will be split by AppKitUrlFilterValidator -->
                        <route name=".authkey" stop="false" pattern="authkey=(authkey:[^/]*)" />
                        <route name=".filter" stop="false" pattern="filter[(filter:.*)]" />
                        <route name=".group" stop="false" pattern="group[(groups:.*?)]" />
                        <route name=".column" stop="false" pattern="columns[(columns:(.*?))]" />
                        <route name=".order" stop="false"
                            pattern="order[(order_col:\w*);(order_dir:\w*)]" />
                        <route name=".limit" stop="false"
                            pattern="limit[({limit_start:\d*};)?(limit:\d*)]" />
                        <route name=".countcolumn" stop="false"
                            pattern="countColumn=(countColumn:\w*)" />
                        <route name=".withMeta" stop="false" pattern="withMeta=(withMeta:\d)" />
                        <route name=".output" stop="true" pattern="(output:json|xml|soap|rest)$"
                            output_type="${output}">
                            <ignores>
                                <ignore>output</ignore>
                            </ignores>
                        </route>

                        <!-- Define the ouput type -->
                    </route>
                    <route name=".output" stop="true" pattern="(output:json|xml)$"
                        output_type="${output}">
                        <ignores>
                            <ignore>output</ignore>
                        </ignores>
                    </route>

                </route>
            </route>
            <!-- END: Icinga (Web) -->

        </routes>
    </ae:configuration>
</ae:configurations>
