﻿<?xml version="1.0" encoding="utf-8" ?>
<xs:schema xmlns="http://schema.webpdf.de/1.0/report/pdfa" elementFormDefault="qualified" targetNamespace="http://schema.webpdf.de/1.0/report/pdfa" xmlns:xs="http://www.w3.org/2001/XMLSchema"
           xmlns:inv="http://schema.webpdf.de/1.0/report/invoice">
    <xs:import namespace="http://schema.webpdf.de/1.0/report/invoice" schemaLocation="invoice.xsd"/>
    <xs:element name="report">
        <xs:complexType>
            <xs:sequence>
                <xs:element name="analysis" type="PdfaAnalysisType" minOccurs="1" maxOccurs="1" />
                <xs:element name="post-analysis" type="PdfaAnalysisType" minOccurs="1" maxOccurs="1" />
                <xs:element name="result" type="PdfaResultType" minOccurs="1" maxOccurs="1" />
                <xs:element ref="inv:invoice" minOccurs="0" maxOccurs="1">
                    <xs:annotation>
                        <xs:documentation>
                            <p>The invoice rule validation result. In the "convert" branch, present when
                                "zugferd &gt; invoiceRuleValidation" was set to a mode other than "disabled" and
                                a report was actually requested ("errorReport" / "successReport" not
                                "none"). In the "analyze" branch, present whenever its own
                                "invoiceRuleValidation" element was set to a mode other than "disabled" - the
                                analysis report is always the response document there. It is the LAST
                                element of this report's sequence, so a reader of an existing report
                                sees the element order it always saw. It is REFERENCED here rather than
                                declared locally, so the embedded element carries the "invoice"
                                namespace of "report/invoice.xsd" and not this report's own namespace -
                                a reader addresses it accordingly.
                            </p>
                        </xs:documentation>
                    </xs:annotation>
                </xs:element>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
    <xs:complexType name="PdfaDetailType">
        <xs:simpleContent>
            <xs:extension base="xs:string">
                <xs:attribute name="code" type="xs:long" use="required" />
                <xs:attribute name="count" type="xs:int" use="required" />
                <xs:attribute name="object" type="xs:int" use="required" />
                <xs:attribute name="page" type="xs:int" use="required" />
                <xs:attribute name="type" type="PdfaMessageType" use="required" />
            </xs:extension>
        </xs:simpleContent>
    </xs:complexType>
    <xs:complexType name="PdfaAnalysisType">
        <xs:sequence>
            <xs:element name="detail" type="PdfaDetailType" minOccurs="0" maxOccurs="unbounded" />
        </xs:sequence>
        <xs:attribute name="error" type="xs:int" use="required" />
        <xs:attribute name="info" type="xs:int" use="required" />
        <xs:attribute name="warning" type="xs:int" use="required" />
    </xs:complexType>
    <xs:simpleType name="PdfaMessageType">
        <xs:restriction base="xs:string">
            <xs:enumeration value="unknown" />
            <xs:enumeration value="warning" />
            <xs:enumeration value="info" />
            <xs:enumeration value="error" />
        </xs:restriction>
    </xs:simpleType>
    <xs:complexType name="PdfaResultType">
        <xs:sequence>
            <xs:element name="error" type="xs:int" minOccurs="1" maxOccurs="1" default="0" />
            <xs:element name="sub-error" type="xs:int" minOccurs="1" maxOccurs="1" default="0" />
            <xs:element name="message" type="xs:string" minOccurs="1" maxOccurs="1" default="" />
        </xs:sequence>
    </xs:complexType>
</xs:schema>