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

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

    <!-- Root element -->
    <xsd:element name="jboss-ejb-client" type="jboss-ejb-clientType">
        <xsd:annotation>
            <xsd:documentation>
                Root element for a jboss-ejb-client.xml file
            </xsd:documentation>
        </xsd:annotation>
    </xsd:element>

    <xsd:complexType name="jboss-ejb-clientType">
        <xsd:annotation>
            <xsd:documentation>
                The EJB client configurations
            </xsd:documentation>
        </xsd:annotation>
        <xsd:all>
            <xsd:element name="client-context" type="client-contextType">
                <xsd:annotation>
                    <xsd:documentation>
                        Configurations that will be used to setup an EJB client context for the
                        deployment.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
        </xsd:all>

    </xsd:complexType>

    <xsd:complexType name="client-contextType">
        <xsd:all>
            <xsd:element name="ejb-receivers" type="ejb-receiversType">
                <xsd:annotation>
                    <xsd:documentation>
                        Configures EJB receivers for the client context
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
        </xsd:all>
    </xsd:complexType>

    <xsd:complexType name="ejb-receiversType">
        <xsd:choice minOccurs="0" maxOccurs="unbounded">
            <xsd:element name="remoting-ejb-receiver" type="remoting-ejb-receiverType">
                <xsd:annotation>
                    <xsd:documentation>
                        Configures a remoting based EJB receiver
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
        </xsd:choice>
        <xsd:attribute name="exclude-local-receiver" type="xsd:boolean" use="optional" default="false">
            <xsd:annotation>
                <xsd:documentation>
                    Set to true if the local receiver which gets added to the EJB client context by default, has to be
                    excluded from the context
                </xsd:documentation>
            </xsd:annotation>
        </xsd:attribute>
        <xsd:attribute name="local-receiver-pass-by-value" type="xsd:boolean" use="optional" default="true">
            <xsd:annotation>
                <xsd:documentation>
                    Set to false if the local receiver that's available in the EJB client context, should use
                    pass-by-reference (instead of pass-by-value) semantics for the EJB invocations.
                </xsd:documentation>
            </xsd:annotation>
        </xsd:attribute>
    </xsd:complexType>


    <xsd:complexType name="remoting-ejb-receiverType">
        <xsd:attribute name="outbound-connection-ref" type="xsd:string" use="required">
            <xsd:annotation>
                <xsd:documentation>
                    Reference to an outbound connection configured in the remoting subsystem
                </xsd:documentation>
            </xsd:annotation>
        </xsd:attribute>
    </xsd:complexType>

</xsd:schema>

