<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
 Copyright (c) 2018, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* Licensed 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:element name="enrich">
        <xs:annotation>
            <xs:documentation source="description">
                Enriches the selected content of a message (the message envelope, body, etc.) according to a given
                specification. The specification for the enhancement can be given inline (within the mediator) or
                extracted using a Property mediator.
            </xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:all>
                <xs:element name="source" type="SourceEnrich" minOccurs="1" maxOccurs="1"/>
                <xs:element name="target" type="TargetEnrich" minOccurs="1" maxOccurs="1"/>
            </xs:all>
        </xs:complexType>
    </xs:element>

    <xs:complexType name="SourceEnrich">
        <xs:sequence>
            <xs:any minOccurs="0" maxOccurs="unbounded" processContents="skip"/>
        </xs:sequence>
        <xs:attribute name="clone" type="xs:boolean" use="optional" default="true"/>
        <xs:attribute name="type" use="optional" default="custom">
            <xs:simpleType>
                <xs:restriction base="xs:string">
                    <xs:enumeration value="custom"/>
                    <xs:enumeration value="envelope"/>
                    <xs:enumeration value="body"/>
                    <xs:enumeration value="property"/>
                    <xs:enumeration value="inline"/>
                </xs:restriction>
            </xs:simpleType>
        </xs:attribute>
        <xs:attribute name="xpath" type="xs:string" use="optional"/>
        <xs:attribute name="property" type="xs:string" use="optional"/>
    </xs:complexType>

    <xs:complexType name="TargetEnrich">
        <xs:attribute name="action" use="optional" default="custom">
            <xs:simpleType>
                <xs:restriction base="xs:string">
                    <xs:enumeration value="replace"/>
                    <xs:enumeration value="child"/>
                    <xs:enumeration value="sibling"/>
                </xs:restriction>
            </xs:simpleType>
        </xs:attribute>
        <xs:attribute name="type" use="optional" default="custom">
            <xs:simpleType>
                <xs:restriction base="xs:string">
                    <xs:enumeration value="custom"/>
                    <xs:enumeration value="envelope"/>
                    <xs:enumeration value="body"/>
                    <xs:enumeration value="property"/>
                </xs:restriction>
            </xs:simpleType>
        </xs:attribute>
        <xs:attribute name="xpath" type="xs:string" use="optional"/>
        <xs:attribute name="property" type="xs:string" use="optional"/>
    </xs:complexType>

</xs:schema>