<?xml version="1.0" encoding="UTF-8"?>

<xsd:schema targetNamespace="http://www.sk.ee/DigiDoc/v1.3.0#"
	xmlns:xsd="http://www.w3.org/2001/XMLSchema"
	xmlns="http://www.sk.ee/DigiDoc/v1.3.0#"
	xmlns:etsi="http://uri.etsi.org/01903/v1.1.1#"
	xmlns:ds="http://www.w3.org/2000/09/xmldsig#"
	elementFormDefault="qualified" >

<xsd:import namespace="http://www.w3.org/2000/09/xmldsig#" 
schemaLocation="xmldsig-core-schema.xsd"/>

<!-- Root element for SignedDoc -->

<xsd:element name="SignedDoc" type="SignedDocType"/>
<xsd:complexType name="SignedDocType">
	<xsd:sequence>
		<xsd:element name="DataFile" type="DataFileType" 
			minOccurs="1" maxOccurs="unbounded"/>
		<xsd:element ref="ds:Signature" 
			minOccurs="0" maxOccurs="unbounded"/>
	</xsd:sequence>
	<xsd:attribute name="format" type="xsd:string" fixed="DIGIDOC-XML"/>
	<xsd:attribute name="version" type="xsd:string" fixed="1.3"/>
</xsd:complexType>

<!-- payload data - DataFile -->

<xsd:complexType name="DataFileType">
  <xsd:simpleContent>
	<xsd:extension base="xsd:string">
		<xsd:attribute name="Id" type="xsd:ID" use="required"/>
		<xsd:attribute name="Filename" type="xsd:string" use="required"/>
		<xsd:attribute name="ContentType">
		<xsd:simpleType>
			<xsd:restriction base="xsd:string">
				<xsd:enumeration value="EMBEDDED"/>
				<xsd:enumeration value="EMBEDDED_BASE64"/>
				<xsd:enumeration value="DETACHED"/>
			</xsd:restriction>
		</xsd:simpleType>
		</xsd:attribute>
		<xsd:attribute name="MimeType" type="xsd:string" use="required"/>
		<xsd:attribute name="Size" type="xsd:decimal" use="required"/>
	<!-- but required for DETATCHED files -->
		<xsd:attribute name="DigestType" type="xsd:string" use="optional"/>
		<xsd:attribute name="DigestValue" type="xsd:string" use="optional"/>
	</xsd:extension>
  </xsd:simpleContent>	
</xsd:complexType>

</xsd:schema>