﻿<?xml version="1.0" encoding="utf-8"?>
<!--
Version: 1
Revision date: 2025-06-20

Changelog:
2025-06-20: Initial release
-->
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:simpleType name="guid">
    <xs:annotation>
      <xs:documentation xml:lang="en">The representation of a GUID, generally the id of an element.</xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:string">
      <xs:pattern value="[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}" />
    </xs:restriction>
  </xs:simpleType>
  <xs:simpleType name="string_maxlength25">
    <xs:restriction base="xs:string">
      <xs:maxLength value="25" />
    </xs:restriction>
  </xs:simpleType>
  <xs:simpleType name="string_maxlength50">
    <xs:restriction base="xs:string">
      <xs:maxLength value="50" />
    </xs:restriction>
  </xs:simpleType>
  <xs:simpleType name="string_maxlength100">
    <xs:restriction base="xs:string">
      <xs:maxLength value="100" />
    </xs:restriction>
  </xs:simpleType>
  <xs:simpleType name="string_maxlength255">
    <xs:restriction base="xs:string">
      <xs:maxLength value="255" />
    </xs:restriction>
  </xs:simpleType>
  <xs:simpleType name="documenttypes">
    <xs:annotation>
      <xs:documentation xml:lang="en">Enumeration with allowed document types. Values must be uppercase.</xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:string">
      <xs:enumeration value="PRODUCTS"/>
      <xs:enumeration value="RELATIONWITHPRODUCTS"/>
      <xs:enumeration value="RELATIONS"/>
      <xs:enumeration value="PRICES"/>
      <xs:enumeration value="ORDERS"/>
      <xs:enumeration value="ORDERRECEIPTS"/>
      <xs:enumeration value="ORDERDELIVERIES"/>
    </xs:restriction>
  </xs:simpleType>
  <xs:simpleType name="discounttypes">
    <xs:annotation>
      <xs:documentation xml:lang="nl">Enumeration with allowed discount types.</xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:unsignedByte">
      <xs:enumeration value="1">
        <xs:annotation>
          <xs:documentation xml:lang="nl">Artikel</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="2">
        <xs:annotation>
          <xs:documentation xml:lang="nl">Relatie</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="3">
        <xs:annotation>
          <xs:documentation xml:lang="nl">Klantcategorie</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>
  <xs:element name="document">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="header">
          <xs:complexType>
            <xs:all>
              <xs:element name="datetimecreatedutc" type="xs:dateTime" />
              <xs:element name="referencenumber" type="string_maxlength100" />
              <xs:element name="documenttype" type="documenttypes" />
              <xs:element name="version" type="xs:unsignedByte" />
              <xs:element name="sender" minOccurs="0">
                <xs:complexType>
                  <xs:all>
                    <xs:element name="name" type="string_maxlength255" minOccurs="0" />
                    <xs:element name="vatnumber" type="string_maxlength25" minOccurs="0" />
                    <xs:element name="cocnumber" type="string_maxlength50" minOccurs="0" />
                    <xs:element name="connectid" type="string_maxlength25" minOccurs="0" />
                    <xs:element name="address" minOccurs="0">
                      <xs:complexType>
                        <xs:all>
                          <xs:element name="streetname" type="string_maxlength255" minOccurs="0" />
                          <xs:element name="cityname" type="string_maxlength100" minOccurs="0" />
                          <xs:element name="postalzone" type="string_maxlength25" minOccurs="0" />
                          <xs:element name="country" minOccurs="0">
                            <xs:complexType>
                              <xs:simpleContent>
                                <xs:extension base="string_maxlength255">
                                  <xs:attribute name="code" type="string_maxlength25" />
                                </xs:extension>
                              </xs:simpleContent>
                            </xs:complexType>
                          </xs:element>
                          <xs:element name="gs1gln" type="string_maxlength25" minOccurs="0" />
                        </xs:all>
                      </xs:complexType>
                    </xs:element>
                    <xs:element name="contact" minOccurs="0">
                      <xs:complexType>
                        <xs:all>
                          <xs:element name="phone" type="string_maxlength50" minOccurs="0" />
                          <xs:element name="email" type="string_maxlength255" minOccurs="0" />
                          <xs:element name="website" type="string_maxlength255" minOccurs="0" />
                        </xs:all>
                      </xs:complexType>
                    </xs:element>
                  </xs:all>
                </xs:complexType>
              </xs:element>
              <xs:element name="receiver" minOccurs="0">
                <xs:complexType>
                  <xs:all>
                    <xs:element name="idrelation" type="guid" minOccurs="0" />
                    <xs:element name="code" type="string_maxlength25" minOccurs="0" />
                    <xs:element name="name" type="string_maxlength255" minOccurs="0" />
                    <xs:element name="creditornumber" type="string_maxlength50" minOccurs="0" />
                    <xs:element name="debtornumber" type="string_maxlength50" minOccurs="0" />
                    <xs:element name="vatnumber" type="string_maxlength25" minOccurs="0" />
                    <xs:element name="cocnumber" type="string_maxlength50" minOccurs="0" />
                    <xs:element name="gs1gln" type="string_maxlength25" minOccurs="0" />
                    <xs:element name="connectid" type="string_maxlength25" minOccurs="0" />
                  </xs:all>
                </xs:complexType>
              </xs:element>
            </xs:all>
          </xs:complexType>
        </xs:element>
        <xs:element name="data" minOccurs="0">
          <xs:complexType>
            <xs:all>
              <xs:element name="relations" minOccurs="0">
                <xs:complexType>
                  <xs:sequence>
                    <xs:element name="relation" maxOccurs="unbounded">
                      <xs:complexType>
                        <xs:all>
                          <xs:element name="idrelation" type="guid" minOccurs="0" />
                          <xs:element name="code" type="string_maxlength25" minOccurs="0" />
                          <xs:element name="name" type="string_maxlength255" />
                          <xs:element name="creditornumber" type="string_maxlength50" minOccurs="0" />
                          <xs:element name="debtornumber" type="string_maxlength50" minOccurs="0" />
                          <xs:element name="vatnumber" type="string_maxlength25" minOccurs="0" />
                          <xs:element name="cocnumber" type="string_maxlength50" minOccurs="0" />
                          <xs:element name="gs1gln" type="string_maxlength25" minOccurs="0" />
                          <xs:element name="connectid" type="string_maxlength25" minOccurs="0" />
                          <xs:element name="isblocked" type="xs:boolean" minOccurs="0" />
                          <xs:element name="customercategory" minOccurs="0">
                            <xs:complexType>
                              <xs:all>
                                <xs:element name="idcustomercategory" type="guid" minOccurs="0" />
                                <xs:element name="code" type="string_maxlength25" minOccurs="0" />
                                <xs:element name="name" type="string_maxlength255" />
                              </xs:all>
                            </xs:complexType>
                          </xs:element>
                          <xs:element name="prices" minOccurs="0">
                            <xs:complexType>
                              <xs:all>
                                <xs:element name="purchase" minOccurs="0">
                                  <xs:complexType>
                                    <xs:sequence>
                                      <xs:element name="product" maxOccurs="unbounded">
                                        <xs:complexType>
                                          <xs:simpleContent>
                                            <xs:extension base="xs:decimal">
                                              <xs:attribute name="idproduct" type="guid" />
                                              <xs:attribute name="code" type="string_maxlength25" use="required" />
                                              <xs:attribute name="name" type="string_maxlength255" />
                                              <xs:attribute name="composition" type="string_maxlength255" />
                                              <xs:attribute name="barcode" type="string_maxlength255" />
                                              <xs:attribute name="vatpercent" type="xs:decimal" />
                                            </xs:extension>
                                          </xs:simpleContent>
                                        </xs:complexType>
                                      </xs:element>
                                    </xs:sequence>
                                  </xs:complexType>
                                </xs:element>
                                <xs:element name="sales" minOccurs="0">
                                  <xs:complexType>
                                    <xs:sequence>
                                      <xs:element name="product" maxOccurs="unbounded">
                                        <xs:complexType>
                                          <xs:simpleContent>
                                            <xs:extension base="xs:decimal">
                                              <xs:attribute name="idproduct" type="guid" />
                                              <xs:attribute name="code" type="string_maxlength25" use="required" />
                                              <xs:attribute name="name" type="string_maxlength255" />
                                              <xs:attribute name="composition" type="string_maxlength255" />
                                              <xs:attribute name="barcode" type="string_maxlength255" />
                                              <xs:attribute name="vatpercent" type="xs:decimal" />
                                            </xs:extension>
                                          </xs:simpleContent>
                                        </xs:complexType>
                                      </xs:element>
                                    </xs:sequence>
                                  </xs:complexType>
                                </xs:element>
                              </xs:all>
                            </xs:complexType>
                          </xs:element>
                        </xs:all>
                      </xs:complexType>
                    </xs:element>
                  </xs:sequence>
                </xs:complexType>
              </xs:element>
              <xs:element name="discounts" minOccurs="0">
                <xs:complexType>
                  <xs:sequence>
                    <xs:element name="discount" maxOccurs="unbounded">
                      <xs:complexType>
                        <xs:all>
                          <xs:element name="iddiscount" type="guid" minOccurs="0" />
                          <xs:element name="product">
                            <xs:complexType>
                              <xs:all>
                                <xs:element name="idproduct" type="guid" minOccurs="0" />
                                <xs:element name="code" type="string_maxlength25" />
                                <xs:element name="name" type="string_maxlength255" minOccurs="0" />
                                <xs:element name="composition" type="string_maxlength255" minOccurs="0" />
                                <xs:element name="barcode" type="string_maxlength255" minOccurs="0" />
                              </xs:all>
                            </xs:complexType>
                          </xs:element>
                          <xs:element name="type" minOccurs="0">
                            <xs:complexType>
                              <xs:simpleContent>
                                <xs:extension base="string_maxlength255">
                                  <xs:attribute name="code" type="discounttypes" use="required" />
                                </xs:extension>
                              </xs:simpleContent>
                            </xs:complexType>
                          </xs:element>
                          <xs:element name="relation" minOccurs="0">
                            <xs:complexType>
                              <xs:all>
                                <xs:element name="idrelation" type="guid" minOccurs="0" />
                                <xs:element name="code" type="string_maxlength25" minOccurs="0" />
                                <xs:element name="name" type="string_maxlength255" />
                                <xs:element name="debtornumber" type="string_maxlength50" minOccurs="0" />
                                <xs:element name="gs1gln" type="string_maxlength25" minOccurs="0" />
                              </xs:all>
                            </xs:complexType>
                          </xs:element>
                          <xs:element name="customercategory" minOccurs="0">
                            <xs:complexType>
                              <xs:all>
                                <xs:element name="idcustomercategory" type="guid" minOccurs="0" />
                                <xs:element name="code" type="string_maxlength25" minOccurs="0" />
                                <xs:element name="description" type="string_maxlength255" />
                              </xs:all>
                            </xs:complexType>
                          </xs:element>
                          <xs:element name="datestart" type="xs:date" />
                          <xs:element name="dateend" type="xs:date" minOccurs="0" />
                          <xs:element name="price" type="xs:decimal" />
                          <xs:element name="isblocked" type="xs:boolean" minOccurs="0" />
                        </xs:all>
                      </xs:complexType>
                    </xs:element>
                  </xs:sequence>
                </xs:complexType>
              </xs:element>
            </xs:all>
          </xs:complexType>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>