<?xml version="1.0"?>

<schema targetNamespace="urn:iana:xml:ns:host"
        xmlns:host="urn:iana:xml:ns:host"
        xmlns:epp="urn:iana:xml:ns:epp"
        xmlns:eppcom="urn:iana:xml:ns:eppcom"
        xmlns="http://www.w3.org/2000/10/XMLSchema"
        elementFormDefault="qualified">

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

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

<!--
Types used within an EPP greeting.
-->
  <element name="svc" type="eppcom:emptyType"/>

<!--
Child elements found in EPP commands.
-->
  <element name="check" type="host:mNameType"/>
  <element name="create" type="host:createType"/>
  <element name="delete" type="host:sNameType"/>
  <element name="info" type="host:sNameType"/>
  <element name="update" type="host:updateType"/>

<!--
Child elements of the <create> command.
-->
  <complexType name="createType">
    <sequence>
      <element name="name" type="eppcom:labelType"/>
      <element name="addr" type="host:addrType"
       minOccurs="0" maxOccurs="unbounded"/>
    </sequence>
  </complexType>

  <complexType name="addrType">
    <simpleContent>
      <extension base="host:addrStringType">
        <attribute name="ip" type="host:ipType"
         use="default" value="v4"/>
      </extension>
    </simpleContent>
  </complexType>

  <simpleType name="addrStringType">
    <restriction base="string">
      <minLength value="3"/>
      <maxLength value="45"/>
    </restriction>
  </simpleType>

  <simpleType name="ipType">
    <restriction base="string">
      <enumeration value="v4"/>
      <enumeration value="v6"/>
    </restriction>
  </simpleType>

<!--
Child elements of the <delete> and <info> commands.
-->
  <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 <update> command.
-->
  <complexType name="updateType">
    <sequence>
      <element name="name" type="eppcom:labelType"/>
      <element name="add" type="host:addRemType"
       minOccurs="0"/>
      <element name="rem" type="host:addRemType"
       minOccurs="0"/>
      <element name="chg" type="host:chgType"
       minOccurs="0"/>
    </sequence>
  </complexType>

<!--
Data elements that can be added or removed.
-->
  <complexType name="addRemType">
    <sequence>
      <element name="addr" type="host:addrType"
       minOccurs="0" maxOccurs="unbounded"/>
      <element name="status" type="host:statusType"
       minOccurs="0"/>
    </sequence>
  </complexType>

<!--
Data elements that can be changed.
-->
  <complexType name="chgType">
    <sequence>
      <element name="name" type="eppcom:labelType"/>
    </sequence>
  </complexType>

<!--
Child response elements.
-->
  <element name="chkData" type="host:chkDataType"/>
  <element name="creData" type="host:creDataType"/>
  <element name="infData" type="host:infDataType"/>

<!--
<check> response elements.
-->
  <complexType name="chkDataType">
    <sequence>
      <element name="cd" type="host:checkedType"
       maxOccurs="unbounded"/>
    </sequence>
  </complexType>
  
  <complexType name="checkedType">
    <simpleContent>
      <extension base = "eppcom:labelType">
        <attribute name="x" type="eppcom:checkType" use="required"/>
      </extension>
    </simpleContent>
  </complexType>

<!--
<create> response elements.
-->
  <complexType name="creDataType">
    <sequence>
      <element name="name" type="eppcom:labelType"/>
      <element name="roid" type="eppcom:roidType"/>
    </sequence>
  </complexType>

<!--
<info> response elements.
-->
  <complexType name="infDataType">
    <sequence>
      <element name="name" type="eppcom:labelType"/>
      <element name="roid" type="eppcom:roidType"/>
      <element name="linked" type="boolean"/>
      <element name="status" type="host:statusType"
       maxOccurs="3"/>
      <element name="addr" type="host:addrType"
       minOccurs="0" maxOccurs="unbounded"/>
      <element name="clID" type="eppcom:clIDType"/>
      <element name="crID" type="eppcom:clIDType"/>
      <element name="crDate" type="timeInstant"/>
      <element name="upID" type="eppcom:clIDType"
       minOccurs="0"/>
      <element name="upDate" type="timeInstant"
       minOccurs="0"/>
      <element name="trDate" type="timeInstant"
       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="string">
        <attribute name="s" type="host:statusValueType"
         use="default" value="ok"/>
        <attribute name="lang" type="language"
         use="default" value="en-US"/>
      </extension>
    </simpleContent>
  </complexType>

  <simpleType name="statusValueType">
    <restriction base="string">
      <enumeration value="lock"/>
      <enumeration value="ok"/>
      <enumeration value="pendingDelete"/>
      <enumeration value="clientLock"/>
    </restriction>
  </simpleType>

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