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

<!--
  ~ Copyright The WildFly Authors
  ~ SPDX-License-Identifier: Apache-2.0
  -->
<xs:schema targetNamespace="urn:jboss:domain:jgroups:2.0"
            xmlns:xs="http://www.w3.org/2001/XMLSchema"
            xmlns:tns="urn:jboss:domain:jgroups:2.0"
            elementFormDefault="qualified"
            attributeFormDefault="unqualified"
            version="2.0">

    <xs:element name="subsystem" type="tns:subsystem">
        <xs:annotation>
            <xs:documentation>Enumerates the protocol stacks available to the channel factory.</xs:documentation>
        </xs:annotation>
    </xs:element>

    <xs:complexType name="subsystem">
        <xs:sequence>
            <xs:element name="stack" type="tns:stack" maxOccurs="unbounded">
                <xs:annotation>
                    <xs:documentation>Defines a protocol stack.</xs:documentation>
                </xs:annotation>
            </xs:element>
        </xs:sequence>
        <xs:attribute name="default-stack" type="xs:string" use="required">
            <xs:annotation>
                <xs:documentation>Identifies the default protocol stack.</xs:documentation>
            </xs:annotation>
        </xs:attribute>
    </xs:complexType>

    <xs:complexType name="stack">
        <xs:sequence>
            <xs:element name="transport" type="tns:transport">
                <xs:annotation>
                    <xs:documentation>Defines the transport protocol for a stack.</xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element name="protocol" type="tns:protocol" minOccurs="0" maxOccurs="unbounded">
                <xs:annotation>
                    <xs:documentation>Defines a non-transport protocol for a stack.</xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element name="relay" type="tns:relay" minOccurs="0">
                <xs:annotation>
                    <xs:documentation>Defines a relay protocol for a stack.</xs:documentation>
                </xs:annotation>
            </xs:element>
        </xs:sequence>
        <xs:attribute name="name" type="xs:string" use="required">
            <xs:annotation>
                <xs:documentation>Uniquely identifies this stack.</xs:documentation>
            </xs:annotation>
        </xs:attribute>
    </xs:complexType>

    <xs:complexType name="protocol">
        <xs:sequence>
            <xs:element name="property" type="tns:property" minOccurs="0" maxOccurs="unbounded">
                <xs:annotation>
                    <xs:documentation>Defines a property override for a protocol.</xs:documentation>
                </xs:annotation>
            </xs:element>
        </xs:sequence>
        <xs:attribute name="type" type="xs:string" use="required">
            <xs:annotation>
                <xs:documentation>Identifies the protocol type, e.g. TCP, UDP, PING, etc.</xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute name="socket-binding" type="xs:string">
            <xs:annotation>
                <xs:documentation>Provides an address/port binding for a protocol.</xs:documentation>
            </xs:annotation>
        </xs:attribute>
    </xs:complexType>

    <xs:complexType name="transport">
        <xs:complexContent>
            <xs:extension base="tns:protocol">
                <xs:attribute name="shared" type="xs:boolean" default="true">
                    <xs:annotation>
                        <xs:documentation>Indicates whether or not the channels created for this stack should use a single, shared transport.</xs:documentation>
                    </xs:annotation>
                </xs:attribute>
                <xs:attribute name="diagnostics-socket-binding" type="xs:string">
                    <xs:annotation>
                        <xs:documentation>If specified, enables diagnostics and specified the multicast address/port on which to communicate.</xs:documentation>
                    </xs:annotation>
                </xs:attribute>
                <xs:attribute name="default-executor" type="xs:string">
                    <xs:annotation>
                        <xs:documentation>Defines the thread pool used for default messages received by this transport.</xs:documentation>
                    </xs:annotation>
                </xs:attribute>
                <xs:attribute name="oob-executor" type="xs:string">
                    <xs:annotation>
                        <xs:documentation>Defines the thread pool used for OOB messages received by this transport.</xs:documentation>
                    </xs:annotation>
                </xs:attribute>
                <xs:attribute name="timer-executor" type="xs:string">
                    <xs:annotation>
                        <xs:documentation>Defines the timer thread pool used by this transport.</xs:documentation>
                    </xs:annotation>
                </xs:attribute>
                <xs:attribute name="thread-factory" type="xs:string">
                    <xs:annotation>
                        <xs:documentation>Defines the thread factory used by this transport.</xs:documentation>
                    </xs:annotation>
                </xs:attribute>
                <xs:attribute name="site" type="xs:string">
                    <xs:annotation>
                        <xs:documentation>Identifies the site where this node runs.</xs:documentation>
                    </xs:annotation>
                </xs:attribute>
                <xs:attribute name="rack" type="xs:string">
                    <xs:annotation>
                        <xs:documentation>Identifies the rack where this node runs.</xs:documentation>
                    </xs:annotation>
                </xs:attribute>
                <xs:attribute name="machine" type="xs:string">
                    <xs:annotation>
                        <xs:documentation>Identifies the machine where this node runs.</xs:documentation>
                    </xs:annotation>
                </xs:attribute>
            </xs:extension>
        </xs:complexContent>
    </xs:complexType>

    <xs:complexType name="property">
        <xs:simpleContent>
            <xs:extension base="xs:string">
                <xs:attribute name="name" type="xs:string" use="required">
                    <xs:annotation>
                        <xs:documentation>Defines the name of a protocol property.</xs:documentation>
                    </xs:annotation>
                </xs:attribute>
            </xs:extension>
        </xs:simpleContent>
    </xs:complexType>

    <xs:complexType name="relay">
        <xs:sequence>
            <xs:element name="remote-site" type="tns:remote-site" maxOccurs="unbounded">
                <xs:annotation>
                    <xs:documentation>Defines a remote site to which to bridge.</xs:documentation>
                </xs:annotation>
            </xs:element>
        </xs:sequence>
        <xs:attribute name="site" type="xs:string" use="required">
            <xs:annotation>
                <xs:documentation>The name of our site.</xs:documentation>
            </xs:annotation>
        </xs:attribute>
    </xs:complexType>

    <xs:complexType name="remote-site">
        <xs:attribute name="name" type="xs:string" use="required">
            <xs:annotation>
                <xs:documentation>The name of the remote site.</xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute name="stack" type="xs:string" use="required">
            <xs:annotation>
                <xs:documentation>The stack name used to create a bridge channel to this remote site.</xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute name="cluster" type="xs:string">
            <xs:annotation>
                <xs:documentation>The cluster name of the channel that bridges this remote site.</xs:documentation>
            </xs:annotation>
        </xs:attribute>
    </xs:complexType>
</xs:schema>
