<?xml version="1.0" encoding="UTF-8"?>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:element name="datastore-indexes" type="datastore-indexesType"/>
  <xs:complexType name="propertyType">
    <xs:simpleContent>
      <xs:extension base="xs:string">
        <xs:attribute type="xs:string" name="name" use="required"/>
        <xs:attribute type="directionType" name="direction" use="required"/>
      </xs:extension>
    </xs:simpleContent>
  </xs:complexType>

  <xs:complexType name="datastore-indexesType">
    <xs:attribute type="xs:boolean" name="autoGenerate" use="required"/>
    <xs:sequence>
      <xs:element type="datastore-indexType" name="datastore-index" maxOccurs="unbounded" minOccurs="0">
        <xs:annotation>
          <xs:documentation>Number of uses in query history</xs:documentation>
        </xs:annotation>
      </xs:element>
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="datastore-indexType">
    <xs:sequence>
      <xs:element type="propertyType" name="property" maxOccurs="unbounded" minOccurs="0"/>
    </xs:sequence>
    <xs:attribute type="xs:string" name="kind" use="required"/>
    <xs:attribute type="xs:boolean" name="ancestor" use="required"/>
  </xs:complexType>

  <xs:simpleType name="directionType">
    <xs:restriction base="xs:string">
      <xs:enumeration value="asc"/>
      <xs:enumeration value="desc"/>
    </xs:restriction>
  </xs:simpleType>

</xs:schema>
