<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
  ~  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.
  -->

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"
           targetNamespace="http://ws.apache.org/ns/synapse"
           xmlns="http://ws.apache.org/ns/synapse">

    <xs:include schemaLocation="misc/target.xsd"/>
    <xs:include schemaLocation="misc/common.xsd"/>

    <xs:element name="proxy" type="Proxy">
        <xs:annotation>
            <xs:documentation source="description">
                Proxy Service element in the Synapse Configuration
            </xs:documentation>
        </xs:annotation>
    </xs:element>

    <xs:complexType name="Proxy">
        <xs:annotation>
            <xs:documentation source="description">
                This is the element type representing the proxy services in the Synapse Configuration
            </xs:documentation>
        </xs:annotation>
        <xs:choice maxOccurs="unbounded">
            <xs:element name="description" minOccurs="0" maxOccurs="1">
                <xs:annotation>
                    <xs:documentation source="description">
                        This is the representation of the proxy service description.
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element name="target" type="ProxyTarget" minOccurs="1" maxOccurs="1"/>
            <xs:element name="publishWSDL" minOccurs="0" maxOccurs="1">
                <xs:annotation>
                    <xs:documentation source="description">
                        This is used to specify the WSDL of the proxy
                    </xs:documentation>
                </xs:annotation>
                <xs:complexType>
                    <!-- TODO : this needs to be altered in the configuration to support correctly -->
                    <xs:sequence>
                        <xs:group ref="inlineWsdl" minOccurs="0" maxOccurs="1"/>
                        <xs:element ref="resource" minOccurs="0" maxOccurs="unbounded"/>
                    </xs:sequence>
                    <xs:attribute name="uri" type="xs:anyURI" use="optional"/>
                    <xs:attribute name="key" type="xs:string" use="required"/>
                </xs:complexType>
            </xs:element>
            <xs:element name="enableAddressing" minOccurs="0" maxOccurs="1"/>
            <xs:element name="enableSec" minOccurs="0" maxOccurs="1"/>
            <xs:element name="enableRM" minOccurs="0" maxOccurs="1"/>
            <xs:element name="policy" minOccurs="0" maxOccurs="unbounded">
                <xs:complexType>
                    <xs:attribute name="key" type="xs:string" use="required"/>
                    <xs:attribute name="type" type="policyType" use="optional" default="in"/>
                </xs:complexType>
            </xs:element>
            <xs:element ref="parameter" minOccurs="0" maxOccurs="unbounded"/>
        </xs:choice>
        <xs:attributeGroup ref="monitoringAspect"/>
        <xs:attribute name="name" type="xs:string" use="required"/>
        <xs:attribute name="transports" type="xs:string" use="optional"/>
        <xs:attribute name="pinnedServers" type="xs:string" use="optional"/>
        <xs:attribute name="serviceGroup" type="xs:string" use="optional"/>
        <xs:attribute name="startOnLoad" type="xs:boolean" use="optional"/>
    </xs:complexType>

    <xs:simpleType name="policyType">
        <xs:annotation>
            <xs:documentation source="description">
                These are policy types including in and out.
            </xs:documentation>
        </xs:annotation>
        <xs:restriction base="xs:string">
            <xs:enumeration value="in"/>
            <xs:enumeration value="out"/>
        </xs:restriction>
    </xs:simpleType>

</xs:schema>

