<?xml version="1.0" encoding="UTF-8"?>
<!--
 Copyright (c) 2009 IETF Trust and the persons identified as authors
   of the code.  All rights reserved.

   Redistribution and use in source and binary forms, with or without
   modification, are permitted provided that the following conditions
   are met:

   o  Redistributions of source code must retain the above copyright
      notice, this list of conditions and the following disclaimer.

   o  Redistributions in binary form must reproduce the above copyright
      notice, this list of conditions and the following disclaimer in
      the documentation and/or other materials provided with the
      distribution.

   o  Neither the name of Internet Society, IETF or IETF Trust, nor the
      names of specific contributors, may be used to endorse or promote
      products derived from this software without specific prior written
      permission.

   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
   A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT
   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->
<schema targetNamespace="urn:ietf:params:xml:ns:domain-1.0"
        xmlns:domain="urn:ietf:params:xml:ns:domain-1.0"
        xmlns:host="urn:ietf:params:xml:ns:host-1.0"
        xmlns:epp="urn:ietf:params:xml:ns:epp-1.0"
        xmlns:eppcom="urn:ietf:params:xml:ns:eppcom-1.0"
        xmlns="http://www.w3.org/2001/XMLSchema"
        elementFormDefault="qualified">

    <!--
    Import common element types.
    -->
    <import namespace="urn:ietf:params:xml:ns:eppcom-1.0"
            schemaLocation="eppcom-1.0.xsd"/>
    <import namespace="urn:ietf:params:xml:ns:epp-1.0"
            schemaLocation="epp-1.0.xsd"/>
    <import namespace="urn:ietf:params:xml:ns:host-1.0"
            schemaLocation="host-1.0.xsd"/>

    <annotation>
        <documentation>
            Extensible Provisioning Protocol v1.0
            domain provisioning schema.
        </documentation>
    </annotation>

    <!--
    Child elements found in EPP commands.
    -->
    <element name="check" type="domain:mNameType"/>
    <element name="create" type="domain:createType"/>
    <element name="delete" type="domain:sNameType"/>
    <element name="info" type="domain:infoType"/>
    <element name="renew" type="domain:renewType"/>
    <element name="transfer" type="domain:transferType"/>
    <element name="update" type="domain:updateType"/>

    <!--
    Child elements of the <create> command.
    -->
    <complexType name="createType">
        <sequence>
            <element name="name" type="eppcom:labelType"/>
            <element name="period" type="domain:periodType"
                     minOccurs="0"/>
            <element name="ns" type="domain:nsType"
                     minOccurs="0"/>
            <element name="registrant" type="eppcom:clIDType"
                     minOccurs="0"/>
            <element name="contact" type="domain:contactType"
                     minOccurs="0" maxOccurs="unbounded"/>
            <element name="authInfo" type="domain:authInfoType"/>
        </sequence>
    </complexType>

    <complexType name="periodType">
        <simpleContent>
            <extension base="domain:pLimitType">
                <attribute name="unit" type="domain:pUnitType"
                           use="required"/>
            </extension>
        </simpleContent>
    </complexType>

    <simpleType name="pLimitType">
        <restriction base="unsignedShort">
            <minInclusive value="1"/>
            <maxInclusive value="99"/>
        </restriction>
    </simpleType>

    <simpleType name="pUnitType">
        <restriction base="token">
            <enumeration value="y"/>
            <enumeration value="m"/>
        </restriction>
    </simpleType>

    <complexType name="nsType">
        <choice>
            <element name="hostObj" type="eppcom:labelType"
                     maxOccurs="unbounded"/>
            <element name="hostAttr" type="domain:hostAttrType"
                     maxOccurs="unbounded"/>
        </choice>
    </complexType>
    <!--
    Name servers are either host objects or attributes.
    -->

    <complexType name="hostAttrType">
        <sequence>
            <element name="hostName" type="eppcom:labelType"/>
            <element name="hostAddr" type="host:addrType"
                     minOccurs="0" maxOccurs="unbounded"/>
        </sequence>
    </complexType>
    <!--
    If attributes, addresses are optional and follow the
    structure defined in the host mapping.
    -->

    <complexType name="contactType">
        <simpleContent>
            <extension base="eppcom:clIDType">
                <attribute name="type" type="domain:contactAttrType"/>
            </extension>
        </simpleContent>
    </complexType>

    <simpleType name="contactAttrType">
        <restriction base="token">
            <enumeration value="admin"/>
            <enumeration value="billing"/>
            <enumeration value="tech"/>
        </restriction>
    </simpleType>

    <complexType name="authInfoType">
        <choice>
            <element name="pw" type="eppcom:pwAuthInfoType"/>
            <element name="ext" type="eppcom:extAuthInfoType"/>
        </choice>
    </complexType>

    <!--
    Child element of commands that require a single name.
    -->
    <complexType name="sNameType">
        <sequence>
            <element name="name" type="eppcom:labelType"/>
        </sequence>
    </complexType>
    <!--
    Child element of commands that accept multiple names.
    -->
    <complexType name="mNameType">
        <sequence>
            <element name="name" type="eppcom:labelType"
                     maxOccurs="unbounded"/>
        </sequence>
    </complexType>

    <!--
    Child elements of the <info> command.
    -->
    <complexType name="infoType">
        <sequence>
            <element name="name" type="domain:infoNameType"/>
            <element name="authInfo" type="domain:authInfoType"
                     minOccurs="0"/>
        </sequence>
    </complexType>

    <complexType name="infoNameType">
        <simpleContent>
            <extension base = "eppcom:labelType">
                <attribute name="hosts" type="domain:hostsType"
                           default="all"/>
            </extension>
        </simpleContent>
    </complexType>

    <simpleType name="hostsType">
        <restriction base="token">
            <enumeration value="all"/>
            <enumeration value="del"/>
            <enumeration value="none"/>
            <enumeration value="sub"/>
        </restriction>
    </simpleType>

    <!--
    Child elements of the <renew> command.
    -->
    <complexType name="renewType">
        <sequence>
            <element name="name" type="eppcom:labelType"/>
            <element name="curExpDate" type="date"/>
            <element name="period" type="domain:periodType"
                     minOccurs="0"/>
        </sequence>
    </complexType>

    <!--
    Child elements of the <transfer> command.
    -->
    <complexType name="transferType">
        <sequence>
            <element name="name" type="eppcom:labelType"/>
            <element name="period" type="domain:periodType"
                     minOccurs="0"/>
            <element name="authInfo" type="domain:authInfoType"
                     minOccurs="0"/>
        </sequence>
    </complexType>

    <!--
    Child elements of the <update> command.
    -->
    <complexType name="updateType">
        <sequence>
            <element name="name" type="eppcom:labelType"/>
            <element name="add" type="domain:addRemType"
                     minOccurs="0"/>
            <element name="rem" type="domain:addRemType"
                     minOccurs="0"/>
            <element name="chg" type="domain:chgType"
                     minOccurs="0"/>
        </sequence>
    </complexType>

    <!--
    Data elements that can be added or removed.
    -->
    <complexType name="addRemType">
        <sequence>
            <element name="ns" type="domain:nsType"
                     minOccurs="0"/>
            <element name="contact" type="domain:contactType"
                     minOccurs="0" maxOccurs="unbounded"/>
            <element name="status" type="domain:statusType"
                     minOccurs="0" maxOccurs="11"/>
        </sequence>
    </complexType>

    <!--
    Data elements that can be changed.
    -->

    <complexType name="chgType">
        <sequence>
            <element name="registrant" type="domain:clIDChgType"
                     minOccurs="0"/>
            <element name="authInfo" type="domain:authInfoChgType"
                     minOccurs="0"/>
        </sequence>
    </complexType>

    <!--
    Allow the registrant value to be nullified by changing the
    minLength restriction to "0".
    -->
    <simpleType name="clIDChgType">
        <restriction base="token">
            <minLength value="0"/>
            <maxLength value="16"/>
        </restriction>
    </simpleType>

    <!--
    Allow the authInfo value to be nullified by including an
    empty element within the choice.
    -->
    <complexType name="authInfoChgType">
        <choice>
            <element name="pw" type="eppcom:pwAuthInfoType"/>
            <element name="ext" type="eppcom:extAuthInfoType"/>
            <element name="null"/>
        </choice>
    </complexType>

    <!--
    Child response elements.
    -->
    <element name="chkData" type="domain:chkDataType"/>
    <element name="creData" type="domain:creDataType"/>
    <element name="infData" type="domain:infDataType"/>
    <element name="panData" type="domain:panDataType"/>
    <element name="renData" type="domain:renDataType"/>
    <element name="trnData" type="domain:trnDataType"/>

    <!--
    <check> response elements.
    -->
    <complexType name="chkDataType">
        <sequence>
            <element name="cd" type="domain:checkType"
                     maxOccurs="unbounded"/>
        </sequence>
    </complexType>

    <complexType name="checkType">
        <sequence>
            <element name="name" type="domain:checkNameType"/>
            <element name="reason" type="eppcom:reasonType"
                     minOccurs="0"/>
        </sequence>
    </complexType>

    <complexType name="checkNameType">
        <simpleContent>
            <extension base="eppcom:labelType">
                <attribute name="avail" type="boolean"
                           use="required"/>
            </extension>
        </simpleContent>
    </complexType>

    <!--
    <create> response elements.
    -->
    <complexType name="creDataType">
        <sequence>
            <element name="name" type="eppcom:labelType"/>
            <element name="crDate" type="dateTime"/>
            <element name="exDate" type="dateTime"
                     minOccurs="0"/>
        </sequence>
    </complexType>

    <!--
    <info> response elements.
    -->
    <complexType name="infDataType">
        <sequence>
            <element name="name" type="eppcom:labelType"/>
            <element name="roid" type="eppcom:roidType"/>
            <element name="status" type="domain:statusType"
                     minOccurs="0" maxOccurs="11"/>
            <element name="registrant" type="eppcom:clIDType"
                     minOccurs="0"/>
            <element name="contact" type="domain:contactType"
                     minOccurs="0" maxOccurs="unbounded"/>
            <element name="ns" type="domain:nsType"
                     minOccurs="0"/>
            <element name="host" type="eppcom:labelType" minOccurs="0" maxOccurs="unbounded"><annotation><documentation>NOT USED, all nameservers must be registered. Only "ns" element is used</documentation></annotation></element>
            <element name="clID" type="eppcom:clIDType"><annotation><documentation>NOT USED. Set to admin contact</documentation></annotation></element>
            <element name="crID" type="eppcom:clIDType"
                     minOccurs="0"/>
            <element name="crDate" type="dateTime"
                     minOccurs="0"/>
            <element name="upID" type="eppcom:clIDType"
                     minOccurs="0"/>
            <element name="upDate" type="dateTime"
                     minOccurs="0"/>
            <element name="exDate" type="dateTime"
                     minOccurs="0"/>
            <element name="trDate" type="dateTime" minOccurs="0"><annotation><documentation>NOT USED</documentation></annotation></element>
            <element name="authInfo" type="domain:authInfoType"
                     minOccurs="0"/>
        </sequence>
    </complexType>

    <!--
    Status is a combination of attributes and an optional human-readable
    message that may be expressed in languages other than English.
    -->
    <complexType name="statusType">
        <simpleContent>
            <extension base="normalizedString">
                <attribute name="s" type="domain:statusValueType"
                           use="required"/>
                <attribute name="lang" type="language"
                           default="en"/>
            </extension>
        </simpleContent>
    </complexType>

    <simpleType name="statusValueType">
        <restriction base="token">
            <enumeration value="clientDeleteProhibited"/>
            <enumeration value="clientHold"><annotation><documentation>DNSP (ISP) requested not to service domain</documentation></annotation></enumeration>
            <enumeration value="clientRenewProhibited"/>
            <enumeration value="clientTransferProhibited"/>
            <enumeration value="clientUpdateProhibited"/>
            <enumeration value="inactive"/>
            <enumeration value="ok"><annotation><documentation>No other status set, domain is delegated</documentation></annotation></enumeration>
            <enumeration value="pendingCreate"/>
            <enumeration value="pendingDelete"><annotation><documentation>Delete process ongoing</documentation></annotation></enumeration>
            <enumeration value="pendingRenew"/>
            <enumeration value="pendingTransfer"/>
            <enumeration value="pendingUpdate"><annotation><documentation>Name server update or registrant transfer ongoing</documentation></annotation></enumeration>
            <enumeration value="serverDeleteProhibited"><annotation><documentation>Dispute lock has been set</documentation></annotation></enumeration>
            <enumeration value="serverHold"><annotation><documentation>Payment missing, technical erros or registration information insufficient</documentation></annotation></enumeration>
            <enumeration value="serverRenewProhibited"/>
            <enumeration value="serverTransferProhibited"/>
            <enumeration value="serverUpdateProhibited"/>
        </restriction>
    </simpleType>

    <!--
    Pending action notification response elements.
    -->
    <complexType name="panDataType">
        <sequence>
            <element name="name" type="domain:paNameType"/>
            <element name="paTRID" type="epp:trIDType"/>
            <element name="paDate" type="dateTime"/>
        </sequence>
    </complexType>

    <complexType name="paNameType">
        <simpleContent>
            <extension base="eppcom:labelType">
                <attribute name="paResult" type="boolean"
                           use="required"/>
            </extension>
        </simpleContent>
    </complexType>

    <!--
    <renew> response elements.
    -->
    <complexType name="renDataType">
        <sequence>
            <element name="name" type="eppcom:labelType"/>
            <element name="exDate" type="dateTime"
                     minOccurs="0"/>
        </sequence>
    </complexType>

    <!--
    <transfer> response elements.
    -->
    <complexType name="trnDataType">
        <sequence>
            <element name="name" type="eppcom:labelType"/>
            <element name="trStatus" type="eppcom:trStatusType"/>
            <element name="reID" type="eppcom:clIDType"/>
            <element name="reDate" type="dateTime"/>
            <element name="acID" type="eppcom:clIDType"/>
            <element name="acDate" type="dateTime"/>
            <element name="exDate" type="dateTime"
                     minOccurs="0"/>
        </sequence>
    </complexType>

    <!--
    End of schema.
    -->
</schema>


