<?xml version="1.0" encoding="UTF-8"?>
<xs:schema
	xmlns:xs="http://www.w3.org/2001/XMLSchema"
	xmlns:envelope_1_0="http://agavi.org/agavi/config/global/envelope/1.0"
	xmlns:types_1_0="http://agavi.org/agavi/config/global/types/1.0"
	xmlns="http://agavi.org/agavi/config/parts/settings/1.0"
	targetNamespace="http://agavi.org/agavi/config/parts/settings/1.0"
	elementFormDefault="qualified"
	version="$Id: settings.xsd 4502 2010-04-23 13:39:31Z david $">

	<xs:import namespace="http://agavi.org/agavi/config/global/types/1.0"
	           schemaLocation="../_types.xsd" />
	<xs:import namespace="http://agavi.org/agavi/config/global/envelope/1.0"
	           schemaLocation="../_envelope.xsd" />

	<!-- System actions -->

	<xs:complexType name="system_action">
		<xs:all>
			<xs:element name="module" type="types_1_0:php_label" />
			<xs:element name="action" type="xs:string" />
		</xs:all>
		<xs:attribute name="name" type="xs:string" />
	</xs:complexType>

	<xs:group name="system_actions">
		<xs:choice>
			<xs:element name="system_actions" type="system_actions"
			            minOccurs="0" />
			<xs:element name="system_action" type="system_action"
			            minOccurs="0" maxOccurs="unbounded" />
		</xs:choice>
	</xs:group>

	<xs:complexType name="system_actions">
		<xs:sequence>
			<xs:element name="system_action" type="system_action"
			            maxOccurs="unbounded" />
		</xs:sequence>
	</xs:complexType>

	<!-- Settings -->

	<xs:complexType name="setting" mixed="true">
		<xs:group ref="envelope_1_0:parameters" />
		<xs:attribute name="name" type="xs:string" use="required" />
	</xs:complexType>

	<xs:complexType name="settings">
		<xs:sequence>
			<xs:element name="setting" type="setting"
			            maxOccurs="unbounded" />
		</xs:sequence>
		<xs:attribute name="prefix" type="xs:string" />
	</xs:complexType>

	<xs:group name="settings">
		<xs:choice>
			<xs:element name="settings" type="settings"
			            minOccurs="0" />
			<xs:element name="setting" type="setting"
			            minOccurs="0" maxOccurs="unbounded" />
		</xs:choice>
	</xs:group>

	<!-- Exception templates -->

	<xs:complexType name="exception_template">
		<xs:simpleContent>
			<xs:extension base="xs:string">
				<xs:attribute name="context" type="xs:string" />
			</xs:extension>
		</xs:simpleContent>
	</xs:complexType>

	<xs:complexType name="exception_templates">
		<xs:sequence>
			<xs:element name="exception_template" type="exception_template"
			            maxOccurs="unbounded" />
		</xs:sequence>
	</xs:complexType>

	<xs:group name="exception_templates">
		<xs:choice>
			<xs:element name="exception_templates" type="exception_templates"
			            minOccurs="0" />
			<xs:element name="exception_template" type="exception_template"
			            minOccurs="0" maxOccurs="unbounded" />
		</xs:choice>
	</xs:group>

	<xs:group name="configuration">
		<xs:sequence>
			<xs:sequence minOccurs="0" maxOccurs="unbounded" >
				<xs:group ref="system_actions"
				          minOccurs="0" />
				<xs:group ref="settings"
				          minOccurs="0" maxOccurs="unbounded" />
				<xs:group ref="exception_templates"
				          minOccurs="0" />
			</xs:sequence>
		</xs:sequence>
	</xs:group>

</xs:schema>
