<?xml version="1.0" encoding="UTF-8"?>
<!-- ~ Copyright (c) 2023 Riege Software International. All rights reserved. ~ Use is subject to license terms -->

<xs:schema targetNamespace="http://dtd.riege.com/scope/shippingorder"
    xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://dtd.riege.com/scope/shippingorder"
    xmlns:so="http://dtd.riege.com/scope/shippingorder" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.w3.org/2001/XMLSchema http://www.w3.org/2001/XMLSchema.xsd"
    elementFormDefault="qualified" attributeFormDefault="unqualified">

    <xs:annotation>
        <xs:documentation>Messages for receiving shipping orders
        </xs:documentation>
    </xs:annotation>

    <xs:element name="shippingOrderMessage">

        <xs:complexType>
            <xs:sequence>
                <xs:element name="messageHeader" type="messageHeader" />
                <xs:element ref="shippingOrder" minOccurs="0" maxOccurs="unbounded" />
            </xs:sequence>
            <xs:attribute name="schemaVersion" type="xs:decimal" use="required" fixed="2.1">
                <xs:annotation>
                    <xs:documentation>Make sure to refer to the correct schema version
                    </xs:documentation>
                </xs:annotation>
            </xs:attribute>
        </xs:complexType>

        <xs:unique name="uniMessageShippingOrderIds">
            <xs:selector xpath=".//so:refs/so:shippingOrderId" />
            <xs:field xpath="." />
        </xs:unique>

    </xs:element>

    <xs:element name="shippingOrder">
        <xs:complexType>
            <xs:sequence>
                <xs:element name="messageHeader" type="messageHeader" />
                <xs:element name="parties" type="parties" />
                <xs:element name="refs" type="refs" />
                <xs:element name="placeOfReceipt" type="location" minOccurs="0" />
                <xs:element name="placeOfDelivery" type="location" minOccurs="0" />
                <xs:element name="dtms" type="dtms" />
                <xs:element name="service" type="service" />
                <xs:element name="moas" type="moas" minOccurs="0" />
                <xs:element name="incoterm" type="incoterm" minOccurs="0" />
                <xs:element name="gids" type="gids" minOccurs="0" />
                <xs:element name="containers" type="containersType" minOccurs="0" />
                <xs:element name="remarks" type="xs:string" minOccurs="0" />
                <xs:element name="attachment" type="attachment" minOccurs="0" maxOccurs="unbounded" />
            </xs:sequence>
        </xs:complexType>
    </xs:element>

    <!-- technical message stuff -->

    <xs:complexType name="messageHeader">
        <xs:sequence>
            <xs:element name="sender" type="communicationParty" />
            <xs:element name="recipient" type="communicationParty" />
            <xs:element name="messageId" type="xs:NMTOKEN" />
            <xs:element name="contact" type="contact" minOccurs="0" />
        </xs:sequence>
        <xs:attribute name="messageCreation" type="xs:dateTime" use="required" />
    </xs:complexType>

    <xs:complexType name="communicationParty">
        <xs:simpleContent>
            <xs:extension base="xs:string">
                <xs:attribute name="code" type="xs:NMTOKEN" use="required" />
            </xs:extension>
        </xs:simpleContent>
    </xs:complexType>

    <!-- addresses -->


    <xs:complexType name="address">
        <xs:sequence>
            <xs:element name="name1" type="xs:string" />
            <xs:element name="name2" type="xs:string" minOccurs="0" maxOccurs="1" />
            <xs:element name="name3" type="xs:string" minOccurs="0" maxOccurs="1" />
            <xs:element name="street1" type="xs:string" />
            <xs:element name="street2" type="xs:string" minOccurs="0" maxOccurs="1" />
            <xs:element name="street3" type="xs:string" minOccurs="0" maxOccurs="1" />
            <xs:element name="city">
                <xs:complexType>
                    <xs:simpleContent>
                        <xs:extension base="xs:string">
                            <xs:attribute name="zip" type="xs:string" use="optional" />
                        </xs:extension>
                    </xs:simpleContent>
                </xs:complexType>
            </xs:element>
            <xs:element name="state" minOccurs="0">
                <xs:complexType>
                    <xs:simpleContent>
                        <xs:extension base="xs:string">
                            <xs:attribute name="code" type="xs:NMTOKEN" use="optional" />
                        </xs:extension>
                    </xs:simpleContent>
                </xs:complexType>
            </xs:element>
            <xs:element name="country" type="countryType" nillable="true" />
            <xs:element name="contact" type="contact" minOccurs="0" />
        </xs:sequence>
        <xs:attribute name="addressId" type="xs:NMTOKEN" />
    </xs:complexType>

    <xs:complexType name="countryType">
        <xs:attribute name="code" use="required">
            <xs:simpleType>
                <xs:restriction base="xs:NMTOKEN">
                    <xs:length value="2" />
                </xs:restriction>
            </xs:simpleType>
        </xs:attribute>
    </xs:complexType>

    <xs:complexType name="contact">
        <xs:sequence>
            <xs:element name="name" type="xs:string" />
            <xs:element name="phone" type="xs:string" minOccurs="0" />
            <xs:element name="fax" type="xs:string" minOccurs="0" />
            <xs:element name="email" type="xs:string" minOccurs="0" />
        </xs:sequence>
    </xs:complexType>

    <xs:complexType name="parties">
        <xs:all>
            <xs:element name="shipper" type="address" minOccurs="0" />
            <xs:element name="consignee" type="address" minOccurs="0" />
            <xs:element name="notify" type="address" minOccurs="0" />
            <xs:element name="customer" type="address" minOccurs="0" />
        </xs:all>
    </xs:complexType>

    <!-- locations -->

    <xs:complexType name="location">
        <xs:sequence>
            <xs:element name="name" type="xs:string" minOccurs="0" />
            <xs:element name="address" type="address" minOccurs="0" />
        </xs:sequence>
        <xs:attribute name="unlocode" use="required">
            <xs:simpleType>
                <xs:restriction base="xs:NMTOKEN">
                    <xs:length value="5" />
                </xs:restriction>
            </xs:simpleType>
        </xs:attribute>
        <xs:attribute name="iataCode" use="optional">
            <xs:simpleType>
                <xs:restriction base="xs:NMTOKEN">
                    <xs:length value="3" />
                </xs:restriction>
            </xs:simpleType>
        </xs:attribute>
    </xs:complexType>

    <!-- references -->

    <xs:complexType name="refs">
        <xs:sequence>
            <xs:element name="shippingOrderId" type="xs:string">
                <xs:annotation>
                    <xs:documentation>
                        The unique reference number for this consignment
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element name="ref" type="ref" minOccurs="0" maxOccurs="unbounded" />
        </xs:sequence>
    </xs:complexType>

    <xs:complexType name="ref">
        <xs:simpleContent>
            <xs:extension base="xs:string">
                <xs:attribute name="qual" type="referenceQualifier" use="required" />
            </xs:extension>
        </xs:simpleContent>
    </xs:complexType>

    <xs:simpleType name="referenceQualifier">
        <xs:restriction base="xs:NMTOKEN">
            <xs:enumeration value="HWB">
                <xs:annotation>
                    <xs:documentation>Suggested house airwaybill number
                    </xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="MAWB">
                <xs:annotation>
                    <xs:documentation>Suggested master airwaybill number
                    </xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="AAG">
                <xs:annotation>
                    <xs:documentation>Offer number</xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="AAG">
                <xs:annotation>
                    <xs:documentation>Offer number</xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="AAJ">
                <xs:annotation>
                    <xs:documentation>Delivery order number</xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="AAN">
                <xs:annotation>
                    <xs:documentation>Delivery schedule number</xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="AAO">
                <xs:annotation>
                    <xs:documentation>Consignee's shipment reference number
                    </xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="ABR">
                <xs:annotation>
                    <xs:documentation>Export clearance instruction reference number
                    </xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="ABT">
                <xs:annotation>
                    <xs:documentation>Customs reference number</xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="AEP">
                <xs:annotation>
                    <xs:documentation>Project number</xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="AFC">
                <xs:annotation>
                    <xs:documentation>Bordereau number</xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="BC">
                <xs:annotation>
                    <xs:documentation>Buyer's contract number</xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="CR">
                <xs:annotation>
                    <xs:documentation>Customer reference number</xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="CU">
                <xs:annotation>
                    <xs:documentation>Consignor's reference number</xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="DQ">
                <xs:annotation>
                    <xs:documentation>Delivery note number</xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="IV">
                <xs:annotation>
                    <xs:documentation>Invoice number</xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="ON">
                <xs:annotation>
                    <xs:documentation>Order number (purchase)</xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="VC">
                <xs:annotation>
                    <xs:documentation>Vendor contract number</xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="ZZZ">
                <xs:annotation>
                    <xs:documentation>Mutually defined reference number
                    </xs:documentation>
                </xs:annotation>
            </xs:enumeration>
        </xs:restriction>
    </xs:simpleType>

    <!-- timestamps -->
    <xs:complexType name="dtms">
        <xs:sequence>
            <xs:element name="dtm" type="dtm" minOccurs="0" maxOccurs="unbounded" />
        </xs:sequence>
    </xs:complexType>

    <xs:complexType name="dtm">
        <xs:simpleContent>
            <xs:extension base="xs:dateTime">
                <xs:attribute name="qual" type="dtmQualifier" use="required" />
            </xs:extension>
        </xs:simpleContent>
    </xs:complexType>

    <xs:simpleType name="dtmQualifier">
        <xs:restriction base="xs:NMTOKEN">
            <xs:enumeration value="pickup" />
            <xs:enumeration value="delivery" />
            <xs:enumeration value="actualPickup" />
        </xs:restriction>
    </xs:simpleType>

    <!-- commercial / order -->

    <xs:complexType name="incoterm">
        <xs:sequence>
            <xs:element name="incotermPlace" type="xs:string" minOccurs="0" />
        </xs:sequence>
        <xs:attribute name="code" use="required">
            <xs:simpleType>
                <xs:restriction base="xs:NMTOKEN">
                    <xs:length value="3" />
                </xs:restriction>
            </xs:simpleType>
        </xs:attribute>
    </xs:complexType>

    <xs:complexType name="service">
        <xs:simpleContent>
            <xs:extension base="xs:string">
                <xs:attribute name="code" type="xs:NMTOKEN" use="optional" />
                <xs:attribute name="modeOfTransport" use="required" type="modeOfTransport" />
                <xs:attribute name="origin" use="optional" type="movementScopeType" />
                <xs:attribute name="destination" use="optional" type="movementScopeType" />
            </xs:extension>
        </xs:simpleContent>
    </xs:complexType>

    <xs:simpleType name="movementScopeType">
        <xs:restriction base="xs:string">
            <xs:enumeration value="door" />
            <xs:enumeration value="port" />
        </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name="modeOfTransport">
        <xs:restriction base="xs:NMTOKEN">
            <xs:enumeration value="air" />
            <xs:enumeration value="sea" />
            <xs:enumeration value="road" />
        </xs:restriction>
    </xs:simpleType>

    <!-- gid -->

    <xs:complexType name="gid">
        <xs:sequence>
            <xs:element name="originCountry" type="countryType" minOccurs="0" />
            <xs:element name="pieces" type="pieces" />
            <xs:element name="grossWeight" type="mea" />
            <xs:element name="chargeableWeight" type="mea" minOccurs="0" />
            <xs:element name="volume" type="mea" minOccurs="0" />
            <xs:element name="natureOfGoods" type="xs:normalizedString" maxOccurs="unbounded" />
            <xs:element name="dims" type="dimension" minOccurs="0" />
            <xs:element name="tariffCodes" type="tariffCodes" minOccurs="0" />
            <xs:element name="labels" type="labels" minOccurs="0" />
            <xs:element name="dgrs" type="dgrs" minOccurs="0" />
            <xs:element name="serials" type="serialsType" minOccurs="0" />
            <xs:element name="article" type="article" minOccurs="0" />
            <xs:element name="purchaseOrderQuantity" type="xs:positiveInteger" minOccurs="0" />
        </xs:sequence>
    </xs:complexType>

    <xs:complexType name="gids">
        <xs:sequence>
            <xs:element name="originCountry" type="countryType" minOccurs="0" />
            <xs:element name="gid" type="gid" maxOccurs="unbounded" />
        </xs:sequence>
    </xs:complexType>

    <xs:complexType name="mea">
        <xs:simpleContent>
            <xs:extension base="xs:decimal">
                <xs:attribute name="unit" use="required" type="meaUnit" />
            </xs:extension>
        </xs:simpleContent>
    </xs:complexType>

    <xs:simpleType name="meaUnit">
        <xs:annotation>
            <xs:documentation>
                Use UN CEFACT Rec. 20 three-alpha Codes, e.g. KGM, MTQ, CMT
            </xs:documentation>
        </xs:annotation>
        <xs:restriction base="xs:NMTOKEN">
            <xs:length value="3" />
        </xs:restriction>
    </xs:simpleType>

    <xs:complexType name="pieces">
        <xs:simpleContent>
            <xs:extension base="xs:positiveInteger">
                <xs:attribute name="packageType" use="required">
                    <xs:annotation>
                        <xs:documentation>
                            Use UN CEFACT Rec. 21 two-alpha Codes, e.g. BX, CT. Scope will send
                            PK as default.
                        </xs:documentation>
                    </xs:annotation>
                    <xs:simpleType>
                        <xs:restriction base="xs:NMTOKEN">
                            <xs:length value="2" />
                        </xs:restriction>
                    </xs:simpleType>
                </xs:attribute>
            </xs:extension>
        </xs:simpleContent>
    </xs:complexType>

    <xs:complexType name="dimension">
        <xs:attribute name="length" type="positiveDecimal" use="required" />
        <xs:attribute name="width" type="positiveDecimal" use="required" />
        <xs:attribute name="height" type="positiveDecimal" use="required" />
        <xs:attribute name="unit" type="meaUnit" use="required" fixed="CMT" />
    </xs:complexType>

    <xs:simpleType name="positiveDecimal">
        <xs:restriction base="xs:decimal">
            <xs:minInclusive value="0.001" />
            <xs:fractionDigits value="3" />
        </xs:restriction>
    </xs:simpleType>

    <xs:complexType name="tariffCodes">
        <xs:sequence>
            <xs:element name="tariffCode" type="tariffCode" maxOccurs="unbounded" />
        </xs:sequence>
    </xs:complexType>

    <xs:complexType name="tariffCode">
        <xs:simpleContent>
            <xs:extension base="xs:NMTOKEN">
                <xs:attribute name="tariffSystem" type="tariffSystem" use="required" />
            </xs:extension>
        </xs:simpleContent>
    </xs:complexType>

    <xs:simpleType name="tariffSystem">
        <xs:restriction base="xs:NMTOKEN">
            <xs:enumeration value="WCO-HS">
                <xs:annotation>
                    <xs:documentation>
                        Harmonized System Codes issued by the WCO (6 digits)
                    </xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="EU-CN">
                <xs:annotation>
                    <xs:documentation>
                        EU Combined Nomenclature (8 digits), TARIC
                    </xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="US-HTS">
                <xs:annotation>
                    <xs:documentation>
                        U.S. Harmonized Tariff Schedule (10 digits)
                    </xs:documentation>
                </xs:annotation>
            </xs:enumeration>
        </xs:restriction>
    </xs:simpleType>

    <xs:complexType name="article">
        <xs:sequence>
            <xs:element name="articleNumber" type="xs:token" />
            <xs:element name="articleVariant" type="xs:token" minOccurs="0" />
        </xs:sequence>
    </xs:complexType>

    <!-- containers -->

    <xs:complexType name="containersType">
        <xs:sequence>
            <xs:element name="container" type="containerType" maxOccurs="unbounded" />
        </xs:sequence>
    </xs:complexType>

    <xs:complexType name="containerType">
        <xs:attribute name="isoTypeCode" type="isoTypeCodeType" use="required" />
        <xs:attribute name="count" type="xs:int" />
    </xs:complexType>

    <xs:simpleType name="isoTypeCodeType">
        <xs:annotation>
            <xs:documentation>
                Use ISO6346 container codes, e.g. 20DV, 40OT
            </xs:documentation>
        </xs:annotation>
        <xs:restriction base="xs:NMTOKEN">
            <xs:length value="4" />
        </xs:restriction>
    </xs:simpleType>

    <!-- package markings -->

    <xs:complexType name="labels">
        <xs:sequence>
            <xs:element name="label" type="label" maxOccurs="unbounded" />
        </xs:sequence>
    </xs:complexType>

    <xs:complexType name="label">
        <xs:simpleContent>
            <xs:extension base="xs:string">
                <xs:attribute name="labelType" type="labelType" use="required" />
            </xs:extension>
        </xs:simpleContent>
    </xs:complexType>

    <xs:simpleType name="labelType">
        <xs:restriction base="xs:NMTOKEN">
            <xs:enumeration value="sscc">
                <xs:annotation>
                    <xs:documentation>
                        Serial Shipping Container Code, e.g. package ID issued by
                        the shipper
                    </xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="other">
                <xs:annotation>
                    <xs:documentation>
                        Other means of package ID
                    </xs:documentation>
                </xs:annotation>
            </xs:enumeration>
        </xs:restriction>
    </xs:simpleType>

    <!-- serial numbers -->

    <xs:complexType name="serialsType">
        <xs:sequence>
            <xs:element name="serial" type="xs:NMTOKEN" maxOccurs="unbounded" />
        </xs:sequence>
    </xs:complexType>

    <!-- dangerous goods -->

    <xs:complexType name="dgr">
        <xs:sequence>
            <xs:element name="dgrClass" type="dgrClass" />
            <xs:element name="unNumber" type="unNumberDgr" />
            <xs:element name="cao" type="xs:boolean" />
            <xs:element name="category" type="radioactiveCategory" minOccurs="0" />
            <xs:element name="shippingName" type="xs:string" minOccurs="0" />
            <xs:element name="technicalName" type="xs:string" minOccurs="0" />
            <xs:element name="netAmount" type="mea" minOccurs="0" />
            <xs:element name="packingGroup" type="packingGroup" minOccurs="0" />
        </xs:sequence>
    </xs:complexType>

    <xs:complexType name="dgrs">
        <xs:sequence>
            <xs:element name="dgr" type="dgr" maxOccurs="unbounded" />
        </xs:sequence>
    </xs:complexType>

    <xs:simpleType name="unNumberDgr">
        <xs:restriction base="xs:NMTOKEN">
            <xs:length value="4" />
        </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name="packingGroup">
        <xs:restriction base="xs:positiveInteger">
            <xs:minInclusive value="1" />
            <xs:maxInclusive value="3" />
        </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name="dgrClass">
        <xs:restriction base="xs:NMTOKEN">
            <xs:enumeration value="1.1A">
                <xs:annotation>
                    <xs:documentation>Explosives Division 1.1 Compatibility Group A
                    </xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="1.1B">
                <xs:annotation>
                    <xs:documentation>Explosives Division 1.1 Compatibility Group B
                    </xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="1.1C">
                <xs:annotation>
                    <xs:documentation>Explosives Division 1.1 Compatibility Group C
                    </xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="1.1D">
                <xs:annotation>
                    <xs:documentation>Explosives Division 1.1 Compatibility Group D
                    </xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="1.1E">
                <xs:annotation>
                    <xs:documentation>Explosives Division 1.1 Compatibility Group E
                    </xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="1.1F">
                <xs:annotation>
                    <xs:documentation>Explosives Division 1.1 Compatibility Group F
                    </xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="1.1G">
                <xs:annotation>
                    <xs:documentation>Explosives Division 1.1 Compatibility Group G
                    </xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="1.1J">
                <xs:annotation>
                    <xs:documentation>Explosives Division 1.1 Compatibility Group J
                    </xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="1.1L">
                <xs:annotation>
                    <xs:documentation>Explosives Division 1.1 Compatibility Group L
                    </xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="1.2B">
                <xs:annotation>
                    <xs:documentation>Explosives Division 1.2 Compatibility Group B
                    </xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="1.2C">
                <xs:annotation>
                    <xs:documentation>Explosives Division 1.2 Compatibility Group C
                    </xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="1.2D">
                <xs:annotation>
                    <xs:documentation>Explosives Division 1.2 Compatibility Group D
                    </xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="1.2E">
                <xs:annotation>
                    <xs:documentation>Explosives Division 1.2 Compatibility Group E
                    </xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="1.2F">
                <xs:annotation>
                    <xs:documentation>Explosives Division 1.2 Compatibility Group F
                    </xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="1.2G">
                <xs:annotation>
                    <xs:documentation>Explosives Division 1.2 Compatibility Group G
                    </xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="1.2H">
                <xs:annotation>
                    <xs:documentation>Explosives Division 1.2 Compatibility Group H
                    </xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="1.2J">
                <xs:annotation>
                    <xs:documentation>Explosives Division 1.2 Compatibility Group J
                    </xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="1.2K">
                <xs:annotation>
                    <xs:documentation>Explosives Division 1.2 Compatibility Group K
                    </xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="1.2L">
                <xs:annotation>
                    <xs:documentation>Explosives Division 1.2 Compatibility Group L
                    </xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="1.3C">
                <xs:annotation>
                    <xs:documentation>Explosives Division 1.3 Compatibility Group C
                    </xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="1.3F">
                <xs:annotation>
                    <xs:documentation>Explosives Division 1.3 Compatibility Group F
                    </xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="1.3G">
                <xs:annotation>
                    <xs:documentation>Explosives Division 1.3 Compatibility Group G
                    </xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="1.3H">
                <xs:annotation>
                    <xs:documentation>Explosives Division 1.3 Compatibility Group H
                    </xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="1.3J">
                <xs:annotation>
                    <xs:documentation>Explosives Division 1.3 Compatibility Group J
                    </xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="1.3K">
                <xs:annotation>
                    <xs:documentation>Explosives Division 1.3 Compatibility Group K
                    </xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="1.3L">
                <xs:annotation>
                    <xs:documentation>Explosives Division 1.3 Compatibility Group L
                    </xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="1.4B">
                <xs:annotation>
                    <xs:documentation>Explosives Division 1.4 Compatibility Group B
                    </xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="1.4C">
                <xs:annotation>
                    <xs:documentation>Explosives Division 1.4 Compatibility Group C
                    </xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="1.4D">
                <xs:annotation>
                    <xs:documentation>Explosives Division 1.4 Compatibility Group D
                    </xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="1.4E">
                <xs:annotation>
                    <xs:documentation>Explosives Division 1.4 Compatibility Group E
                    </xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="1.4F">
                <xs:annotation>
                    <xs:documentation>Explosives Division 1.4 Compatibility Group F
                    </xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="1.4G">
                <xs:annotation>
                    <xs:documentation>Explosives Division 1.4 Compatibility Group G
                    </xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="1.4S">
                <xs:annotation>
                    <xs:documentation>Explosives Division 1.4 Compatibility Group S
                    </xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="1.5D">
                <xs:annotation>
                    <xs:documentation>Explosives Division 1.5 Compatibility Group D
                    </xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="1.6N">
                <xs:annotation>
                    <xs:documentation>Explosives Division 1.5 Compatibility Group N
                    </xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="2.1">
                <xs:annotation>
                    <xs:documentation>Gases / Flammable Gas</xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="2.2">
                <xs:annotation>
                    <xs:documentation>Gases / Non-flammable, Non-toxic Gas
                    </xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="3">
                <xs:annotation>
                    <xs:documentation>Flammable Liquids</xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="4.1">
                <xs:annotation>
                    <xs:documentation>Flammable Solids</xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="4.2">
                <xs:annotation>
                    <xs:documentation>Substances liable to spontaneous combustion
                    </xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="4.3">
                <xs:annotation>
                    <xs:documentation>Substances which, in contact with water, emit
                        flammable gases (Dangerous when wet)
                    </xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="5.1">
                <xs:annotation>
                    <xs:documentation>Oxidizing Substances</xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="5.2">
                <xs:annotation>
                    <xs:documentation>Organic Peroxides</xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="6.1">
                <xs:annotation>
                    <xs:documentation>Toxic Substances</xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="6.2">
                <xs:annotation>
                    <xs:documentation>Infectious Substances</xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="7">
                <xs:annotation>
                    <xs:documentation>Radioactive Substance</xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="8">
                <xs:annotation>
                    <xs:documentation>Corrosives</xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="9">
                <xs:annotation>
                    <xs:documentation>Miscellaneous Dangerous Goods</xs:documentation>
                </xs:annotation>
            </xs:enumeration>
        </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name="radioactiveCategory">
        <xs:restriction base="xs:NMTOKEN">
            <xs:enumeration value="I">
                <xs:annotation>
                    <xs:documentation>Category I - White</xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="II">
                <xs:annotation>
                    <xs:documentation>Category II - Yellow</xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="III">
                <xs:annotation>
                    <xs:documentation>Category III - Yellow</xs:documentation>
                </xs:annotation>
            </xs:enumeration>
        </xs:restriction>
    </xs:simpleType>

    <!-- binary attachments -->

    <xs:complexType name="attachment">
        <xs:sequence>
            <xs:element name="fileName" nillable="false">
                <xs:annotation>
                    <xs:documentation>Physical file name, e.g. "myFile001.txt"
                    </xs:documentation>
                </xs:annotation>
                <xs:simpleType>
                    <xs:restriction base="xs:NMTOKEN">
                        <xs:pattern value="[\p{Lu}\p{Ll}\p{Pd}\.\p{N}\p{Pd}\p{Pc}]{6,255}"></xs:pattern>
                    </xs:restriction>
                </xs:simpleType>
            </xs:element>
            <xs:element name="displayName" nillable="false">
                <xs:annotation>
                    <xs:documentation>Logical file name, e.g. "DN 47110815"
                    </xs:documentation>
                </xs:annotation>
                <xs:simpleType>
                    <xs:restriction base="xs:token">
                        <xs:minLength value="6" />
                        <xs:maxLength value="255" />
                    </xs:restriction>
                </xs:simpleType>
            </xs:element>
            <xs:element name="documentType" type="xs:NMTOKEN" minOccurs="0">
                <xs:annotation>
                    <xs:documentation>
                        Denotes the type of document from a business perspective rather than a
                        technical one.
                        If not mutually agreed otherwise between parties exchanging the
                        documents it is recommended to use
                        unedifact 1001 document name codes in format 'unedifact-nnn'.
                        (See https://service.unece.org/trade/untdid/d16a/tred/tred1001.htm for
                        reference).

                        UN Edifact documents known by Scope 21.8ff:
                        49 (Damage certification),
                        105 (Purchase order),
                        173 (Authorisation to plan and ship orders),
                        271 (Packing list),
                        340 (Shipping instructions),
                        380 (Commercial invoice),
                        530 (Insurance certificate),
                        530 (Insurance policy),
                        550 (Insurance declaration sheet (bordereau)),
                        588 (Transport Means Security Report),
                        610 (Forwarding instructions),
                        632 (Goods receipt),
                        700 (Waybill),
                        703 (House waybill),
                        705 (Bill of lading),
                        714 (House bill of lading),
                        737 (Proof of delivery),
                        740 (Air waybill),
                        741 (Master air waybill),
                        861 (Certificate of origin),
                        890 (Dangerous goods declaration),
                        916 (Related document)

                        Additional documentTypes known by Scope:
                        'accountsPayable',
                        'certificate',
                        'customsDocument',
                        'customsAssessment',
                        'image',
                        'scopeDocument' (Document type to be used for outgoing document messages only.
                        Indicates that the document was created by Scope.)
                        'uploadedDocument' (Document type to be used for outgoing document
                        messages only. Indicates that the document was uploaded to
                        Scope.).

                        Deprecated (use unedifact-nnn instead):
                        'certificateOfOrigin' -> unedifact-861,
                        'commercialInvoice' -> unedifact-380,
                        'packingList' -> unedifact-271,
                        'proofOfDelivery' -> unedifact-737,
                        'other' -> unedifact-916,
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element name="mimeType" minOccurs="0">
                <xs:annotation>
                    <xs:documentation>Use standard MIME types, e.g. "application/pdf"
                        or "image/png"
                    </xs:documentation>
                </xs:annotation>
                <xs:simpleType>
                    <xs:restriction base="xs:token">
                        <xs:pattern
                            value="[A-Za-z0-9][A-Za-z0-9!#$&amp;\-^_\.+]{0,126}/[A-Za-z0-9][A-Za-z0-9!#$&amp;\-^_\.+]{0,126}" />
                    </xs:restriction>
                </xs:simpleType>
            </xs:element>
            <xs:element name="characterSet" type="xs:NMTOKEN" minOccurs="0">
                <xs:annotation>
                    <xs:documentation>
                        This is usually not required for PDF documents or images. Use the
                        <em>Preferred MIME Name</em>
                        of the character set, e.g. "US-ASCII", "ISO-8859-1"
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element name="content" type="xs:string">
                <xs:annotation>
                    <xs:documentation>Base64 encoded content. White-space will be
                        ignored.
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
        </xs:sequence>
    </xs:complexType>

    <xs:simpleType name="contentMimeType">
        <xs:restriction base="xs:NMTOKEN">
            <xs:pattern value="[A-Z0-9!#$\.\+\-^_]{1,127}/[A-Z0-9!#$\.\+\-^_]{1,127}" />
        </xs:restriction>
    </xs:simpleType>

    <xs:complexType name="moas">
        <xs:sequence>
            <xs:element name="moa" type="moaType" minOccurs="0" maxOccurs="unbounded" />
        </xs:sequence>
    </xs:complexType>

    <xs:element name="moa" type="moaType" />

    <xs:complexType name="moaType">
        <xs:attribute name="qual" type="moaQualifiers" use="required" />
        <xs:attribute name="value" type="xs:decimal" use="required" />
        <xs:attribute name="currency" type="xs:NMTOKEN" />
    </xs:complexType>

    <xs:simpleType name="moaQualifiers">
        <xs:restriction base="xs:string">
            <xs:enumeration value="insurance">
                <xs:annotation>
                    <xs:documentation>Insurance Value</xs:documentation>
                </xs:annotation>
            </xs:enumeration>
        </xs:restriction>
    </xs:simpleType>


</xs:schema>
