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

<schema targetNamespace="http://namespace.com.ua/epp/registry-1.0"
        xmlns:nspc="http://namespace.com.ua/epp/registry-1.0"
        xmlns="http://www.w3.org/2001/XMLSchema"
        elementFormDefault="qualified">

  <annotation>
    <documentation>
      The registry's own EPP extension for .ua names.

      On the command side it carries two things: the trademark certificate number
      required for a name directly under .ua, and the confirmation that a host is to
      be deleted together with its delegations.

      On the response side it reports the certificate number back on
      &lt;domain:info&gt;, marks premium names on &lt;domain:check&gt;, and gives the
      sponsoring registrar its own price for the name and the registrar identifier
      the name is held under.

      Declare the namespace at login to receive these elements. The manual describes
      each one in context: https://namespace.com.ua/for-developers
    </documentation>
  </annotation>

  <!--
  In <extension> of <host:delete>: delete the host and remove it from the name servers of every
  domain that uses it. See the manual's Host delete page before sending it — domains you did not
  name in the command lose a name server.
  -->
  <element name="delete" type="nspc:deleteNSType"/>

  <complexType name="deleteNSType">
    <sequence>
      <element name="deleteNS" type="nspc:confirmDeleteType"/>
    </sequence>
  </complexType>

  <complexType name="confirmDeleteType">
    <attribute name="confirm" type="nspc:confirmType" use="required"/>
  </complexType>

  <!-- "yes" is the only accepted value: the attribute exists so the command cannot be sent by
       accident. -->
  <simpleType name="confirmType">
    <restriction base="token">
      <enumeration value="yes"/>
    </restriction>
  </simpleType>

  <!--
  In <extension> of <domain:create> and <domain:update>: the number of the trademark certificate the
  registrant's right to the name rests on. Required for a name directly under .ua and not accepted
  elsewhere.
  -->
  <element name="create" type="nspc:licenseType"/>
  <element name="update" type="nspc:licenseType"/>

  <complexType name="licenseType">
    <sequence>
      <element name="license" type="nspc:license"/>
    </sequence>
  </complexType>

  <simpleType name="license">
    <restriction base="token">
      <maxLength value="50"/>
    </restriction>
  </simpleType>

  <!--
  In <extension> of a <domain:info> reply: the certificate number recorded for the name. The element
  is the same shape as the one the command side uses, so one reader serves both.
  -->
  <element name="infData" type="nspc:licenseType"/>

  <!--
  In <extension> of a <domain:check> reply: which of the names asked about are premium.

  Only premium names appear, so there is no premium="0" form and the block is absent when none of the
  names is premium. Ask for the price with the fee extension; this element says only that the name is
  priced separately.
  -->
  <element name="chkData" type="nspc:chkDataType"/>

  <complexType name="chkDataType">
    <sequence>
      <element name="cd" type="nspc:checkType" maxOccurs="unbounded"/>
    </sequence>
  </complexType>

  <complexType name="checkType">
    <sequence>
      <element name="name" type="nspc:premiumNameType"/>
    </sequence>
  </complexType>

  <complexType name="premiumNameType">
    <simpleContent>
      <extension base="nspc:nameType">
        <attribute name="premium" type="boolean" use="required"/>
      </extension>
    </simpleContent>
  </complexType>

  <!-- The name exactly as it was written in the check, so a Cyrillic name appears here unchanged. -->
  <simpleType name="nameType">
    <restriction base="token">
      <minLength value="1"/>
      <maxLength value="255"/>
    </restriction>
  </simpleType>

  <!--
  In <extension> of a <domain:info> reply to the sponsoring registrar: that registrar's own price for
  this name, one <nspc:price> per operation that can be quoted. An operation with no price is left
  out, and the block is absent when no price can be quoted.
  -->
  <element name="priceData" type="nspc:priceDataType"/>

  <complexType name="priceDataType">
    <sequence>
      <element name="price" type="nspc:priceType" maxOccurs="unbounded"/>
    </sequence>
    <attribute name="channel" type="token"/>
  </complexType>

  <!--
  The amount is a decimal string, unrounded and unformatted ("150.00"). Read it as given rather than
  recomputing it.

  @operation is a token and deliberately not a fixed list: the set of priced operations grows, and an
  enumeration here would reject a reply the registry legitimately sends.

  @currency is a three-letter ISO 4217 code.
  -->
  <complexType name="priceType">
    <simpleContent>
      <extension base="decimal">
        <attribute name="operation" type="token" use="required"/>
        <attribute name="currency" type="nspc:currencyType" use="required"/>
      </extension>
    </simpleContent>
  </complexType>

  <simpleType name="currencyType">
    <restriction base="token">
      <pattern value="[A-Z]{3}"/>
    </restriction>
  </simpleType>

  <!--
  In <extension> of a <domain:info> reply to the sponsoring registrar: the registrar identifier the
  name is held under in the registry of its zone, which is what that registry's WHOIS and RDAP show.
  <domain:clID> in the same reply still names your own account.
  -->
  <element name="registrar" type="token"/>

</schema>
