<?xml version="1.0" encoding="UTF-8"?>

<!--
  ~ JBoss, Home of Professional Open Source.
  ~ Copyright 2017 Red Hat, Inc., and individual contributors
  ~ as indicated by the @author tags.
  ~
  ~ 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"
            targetNamespace="urn:jboss-remoting:5.1"
            xmlns="urn:jboss-remoting:5.1"
            elementFormDefault="qualified"
            attributeFormDefault="unqualified"
            version="1.0">

    <xs:element name="endpoint" type="endpoint-type"/>

    <xs:complexType name="endpoint-type">
        <xs:all minOccurs="0" maxOccurs="1">
            <xs:element name="providers" type="providers-type" minOccurs="0" maxOccurs="1"/>
            <xs:element name="connections" type="connections-type" minOccurs="0" maxOccurs="1"/>
        </xs:all>
        <xs:attribute name="name" use="optional" type="xs:string"/>
        <xs:attribute name="read-timeout" use="optional" type="xs:nonNegativeInteger"/>
        <xs:attribute name="write-timeout" use="optional" type="xs:nonNegativeInteger"/>
        <xs:attribute name="tcp-keepalive" use="optional" type="xs:boolean"/>
        <xs:attribute name="heartbeat-interval" use="optional" type="xs:nonNegativeInteger"/>
    </xs:complexType>

    <xs:complexType name="providers-type">
        <xs:choice minOccurs="0" maxOccurs="unbounded">
            <xs:element name="provider" type="provider-type"/>
        </xs:choice>
    </xs:complexType>

    <xs:complexType name="provider-type">
        <xs:attribute name="scheme" use="required" type="xs:string"/>
        <xs:attribute name="aliases" use="optional" type="string-list-type"/>
        <xs:attribute name="module" use="optional" type="xs:string"/>
        <xs:attribute name="class" use="optional" type="xs:string"/>
    </xs:complexType>

    <xs:complexType name="connections-type">
        <xs:choice minOccurs="0" maxOccurs="unbounded">
            <xs:element name="connection" type="connection-type"/>
        </xs:choice>
    </xs:complexType>

    <xs:complexType name="connection-type">
        <xs:attribute name="destination" use="required" type="xs:anyURI"/>
        <xs:attribute name="read-timeout" use="optional" type="xs:nonNegativeInteger"/>
        <xs:attribute name="write-timeout" use="optional" type="xs:nonNegativeInteger"/>
        <xs:attribute name="ip-traffic-class" use="optional" type="xs:nonNegativeInteger"/>
        <xs:attribute name="tcp-keepalive" use="optional" type="xs:boolean"/>
        <xs:attribute name="heartbeat-interval" use="optional" type="xs:nonNegativeInteger"/>
    </xs:complexType>

    <xs:simpleType name="string-list-type">
        <xs:list itemType="xs:string"/>
    </xs:simpleType>
</xs:schema>
