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

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">

  <xs:simpleType name="stringtype">
    <xs:restriction base="xs:string">
      <xs:minLength value="1" />
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="uritype">
    <xs:restriction base="xs:anyURI">
      <xs:minLength value="1" />
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="sha1type">
    <xs:restriction base="stringtype">
      <xs:pattern value="[0-9a-f]{40}"/>
    </xs:restriction>
  </xs:simpleType>

  <xs:complexType name="hashtype">
    <xs:sequence minOccurs="1" maxOccurs="1">
      <xs:element name="title" type="stringtype"/>
      <xs:element name="file" type="stringtype"/>
      <xs:element name="reference" type="uritype"/>
    </xs:sequence>
    <xs:attribute type="sha1type" name="sha1" use="required"/>
  </xs:complexType>

  <xs:element name="hashes">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="hash" type="hashtype" maxOccurs="unbounded" minOccurs="1"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>

</xs:schema>
