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

<schema targetNamespace="urn:iana:xml:ns:contact-1.0"
        xmlns:contact="urn:iana:xml:ns:contact-1.0"
        xmlns:epp="urn:iana:xml:ns:epp-1.0"
        xmlns:eppcom="urn:iana:xml:ns:eppcom-1.0"
        xmlns="http://www.w3.org/2001/XMLSchema"
        elementFormDefault="qualified">

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

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

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

<!--
Child elements found in EPP commands.
-->
  <element name="check" type="contact:mIDType"/>
  <element name="create" type="contact:createType"/>
  <element name="delete" type="contact:sIDType"/>
  <element name="info" type="contact:sIDType"/>
  <element name="transfer" type="contact:transferType"/>
  <element name="update" type="contact:updateType"/>

<!--
Utility types.
-->
  <simpleType name="ccType">
    <restriction base="token">
      <length value="2"/>
    </restriction>
  </simpleType>

  <complexType name="e164Type">
    <simpleContent>
      <extension base = "contact:e164StringType">
        <attribute name="x" type="normalizedString"
         use="optional"/>
      </extension>
    </simpleContent>
  </complexType>

  <simpleType name="e164StringType">
    <restriction base="normalizedString">
      <pattern value="(\+[0-9]{1,3}\.[0-9]{1,12})?"/>
    </restriction>
  </simpleType>

  <simpleType name="pcType">
    <restriction base="token">
      <maxLength value="10"/>
    </restriction>
  </simpleType>

  <simpleType name="postalLineType">
     <restriction base="normalizedString">
       <maxLength value="30"/>
     </restriction>
  </simpleType>

<!--
Child elements of the <create> and <info> commands.
-->
  <complexType name="createType">
    <sequence>
      <element name="id" type="eppcom:clIDType"/>
      <element name="ascii" type="contact:postalType"/>
      <element name="i15d" type="contact:postalType"
       minOccurs="0"/>
      <element name="voice" type="contact:e164Type"
       minOccurs="0"/>
      <element name="fax" type="contact:e164Type"
       minOccurs="0"/>
      <element name="email" type="normalizedString"/>
      <element name="authInfo" type="eppcom:authInfoType"/>
    </sequence>
  </complexType>

  <complexType name="postalType">
    <sequence>
      <element name="name" type="contact:postalLineType"/>
      <element name="org" type="contact:postalLineType"
       minOccurs="0"/>
      <element name="addr" type="contact:addrType"/>
    </sequence>
  </complexType>

  <complexType name="addrType">
    <sequence>
      <element name="street" type="contact:postalLineType"
       maxOccurs="3"/>
      <element name="city" type="contact:postalLineType"/>
      <element name="sp" type="contact:postalLineType"
       minOccurs="0"/>
      <element name="pc" type="contact:pcType"
       minOccurs="0"/>
      <element name="cc" type="contact:ccType"/>
    </sequence>
  </complexType>

<!--
Child element of commands that require only an identifier.
-->
  <complexType name="sIDType">
    <sequence>
      <element name="id" type="eppcom:clIDType"/>
    </sequence>
  </complexType>

<!--
Child element of commands that accept multiple identifiers.
-->
  <complexType name="mIDType">
    <sequence>
      <element name="id" type="eppcom:clIDType"
       maxOccurs="unbounded"/>
    </sequence>
  </complexType>

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

<!--
Child elements of the <update> command.
-->
  <complexType name="updateType">
    <sequence>
      <element name="id" type="eppcom:clIDType"/>
      <choice minOccurs="1" maxOccurs="3">
        <element name="add" type="contact:addRemType"
         minOccurs="0"/>
        <element name="rem" type="contact:addRemType"
         minOccurs="0"/>
        <element name="chg" type="contact:chgType"
         minOccurs="0"/>
       </choice>
    </sequence>
  </complexType>

<!--
Data elements that can be added or removed.
-->
  <complexType name="addRemType">
    <sequence>
      <element name="status" type="contact:statusType"
       maxOccurs="9"/>
    </sequence>
  </complexType>

<!--
Data elements that can be changed.
-->
  <complexType name="chgType">
    <choice minOccurs="1" maxOccurs="6">
      <element name="ascii" type="contact:chgDataType"
       minOccurs="0"/>
      <element name="i15d" type="contact:chgDataType"
       minOccurs="0"/>
      <element name="voice" type="contact:e164Type"
       minOccurs="0"/>
      <element name="fax" type="contact:e164Type"
       minOccurs="0"/>
      <element name="email" type="normalizedString"
       minOccurs="0"/>
      <element name="authInfo" type="eppcom:authInfoType"
       minOccurs="0"/>
    </choice>
  </complexType>

  <complexType name="chgDataType">
    <choice minOccurs="1" maxOccurs="3">
      <element name="name" type="contact:postalLineType"
       minOccurs="0"/>
      <element name="org" type="contact:postalLineType"
       minOccurs="0"/>
      <element name="addr" type="contact:addrType"
       minOccurs="0"/>
    </choice>
  </complexType>

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

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

  <complexType name="checkType">
    <simpleContent>
      <extension base = "eppcom:clIDType">
        <attribute name="x" type="eppcom:checkType"
         use="required"/>
      </extension>
    </simpleContent>
  </complexType>

<!--
<create> response elements.
-->
  <complexType name="creDataType">
    <sequence>
      <element name="id" type="eppcom:clIDType"/>
    </sequence>
  </complexType>

<!--
<info> response elements.
-->
  <complexType name="infDataType">
    <sequence>
      <element name="id" type="eppcom:clIDType"/>
      <element name="roid" type="eppcom:roidType"/>
      <element name="status" type="contact:statusType"
       maxOccurs="8"/>
      <element name="ascii" type="contact:postalType"/>
      <element name="i15d" type="contact:postalType"
       minOccurs="0"/>
      <element name="voice" type="contact:e164Type"
       minOccurs="0"/>
      <element name="fax" type="contact:e164Type"
       minOccurs="0"/>
      <element name="email" type="normalizedString"/>
      <element name="clID" type="eppcom:clIDType"/>
      <element name="crID" type="eppcom:clIDType"/>
      <element name="crDate" type="dateTime"/>
      <element name="upID" type="eppcom:clIDType"
       minOccurs="0"/>
      <element name="upDate" type="dateTime"
       minOccurs="0"/>
      <element name="trDate" type="dateTime"
       minOccurs="0"/>
      <element name="authInfo" type="eppcom:authInfoType"/>
    </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="contact:statusValueType"
         use="required"/>
        <attribute name="lang" type="language"
         use="optional" default="en"/>
      </extension>
    </simpleContent>
  </complexType>

  <simpleType name="statusValueType">
    <restriction base="token">
      <enumeration value="clientDeleteProhibited"/>
      <enumeration value="clientTransferProhibited"/>
      <enumeration value="clientUpdateProhibited"/>
      <enumeration value="linked"/>
      <enumeration value="ok"/>
      <enumeration value="pendingDelete"/>
      <enumeration value="pendingTransfer"/>
      <enumeration value="serverDeleteProhibited"/>
      <enumeration value="serverTransferProhibited"/>
      <enumeration value="serverUpdateProhibited"/>
    </restriction>
  </simpleType>

<!--
<transfer> response elements.
-->
  <complexType name="trnDataType">
    <sequence>
      <element name="id" type="eppcom:clIDType"/>
      <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"/>
    </sequence>
  </complexType>

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