<!-- (C) 2020 - FreightTrust and Clearing Corporation
   - SPDX-License-Identifier: MPL-2.0
   - SPDXVersion: SPDX-2.2
   - SPDX-FileCopyrightText
   - This Source Code Form is subject to the terms of the Mozilla Public
   - License, v. 2.0. If a copy of the MPL was not distributed with this
   - file, You can obtain one at https://mozilla.org/MPL/2.0/. -->
<xs:schema
    targetNamespace="http://www.freighttrust.com/Schemas/Native/2020/09"
    version="2.0"
    elementFormDefault="qualified"
    xmlns="http://www.freighttrust.com/Schemas/Native/2020/09"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
>
  <xs:include schemaLocation="Native.xsd" />
  <xs:element name="DangerousGood" type="DangerousGoodData" />
  <xs:complexType name="DangerousGoodData">
    <xs:all>
      <xs:element name="UNDGSubstance" type="NativeDangerousGood" />
    </xs:all>
    <xs:attribute name="version" type="xs:token" />
  </xs:complexType>
  <xs:complexType name="NativeDangerousGood">
    <xs:all>
      <!-- Candidate Key: UNNO + Variant + Code -->
      <xs:element name="PK" minOccurs="0" type="xs:string" />
      <xs:element name="UNNO" minOccurs="0">
        <xs:simpleType>
          <xs:restriction base="xs:string">
            <xs:maxLength value="4" />
          </xs:restriction>
        </xs:simpleType>
      </xs:element>
      <xs:element name="Variant" minOccurs="0">
        <xs:simpleType>
          <xs:restriction base="xs:string">
            <xs:maxLength value="1" />
          </xs:restriction>
        </xs:simpleType>
      </xs:element>
      <xs:element name="Variation" minOccurs="0">
        <xs:simpleType>
          <xs:restriction base="xs:string">
            <xs:maxLength value="80" />
          </xs:restriction>
        </xs:simpleType>
      </xs:element>
      <xs:element name="Class" minOccurs="0">
        <xs:simpleType>
          <xs:restriction base="xs:string">
            <xs:maxLength value="4" />
          </xs:restriction>
        </xs:simpleType>
      </xs:element>
      <xs:element name="SubLabel1" minOccurs="0">
        <xs:simpleType>
          <xs:restriction base="xs:string">
            <xs:maxLength value="5" />
          </xs:restriction>
        </xs:simpleType>
      </xs:element>
      <xs:element name="SubLabel2" minOccurs="0">
        <xs:simpleType>
          <xs:restriction base="xs:string">
            <xs:maxLength value="3" />
          </xs:restriction>
        </xs:simpleType>
      </xs:element>
      <xs:element name="PSN" minOccurs="0">
        <xs:simpleType>
          <xs:restriction base="xs:string">
            <xs:maxLength value="100" />
          </xs:restriction>
        </xs:simpleType>
      </xs:element>
      <xs:element name="PG" minOccurs="0">
        <xs:simpleType>
          <xs:restriction base="xs:string">
            <xs:maxLength value="3" />
          </xs:restriction>
        </xs:simpleType>
      </xs:element>
      <xs:element name="EMS" minOccurs="0">
        <xs:simpleType>
          <xs:restriction base="xs:string">
            <xs:maxLength value="8" />
          </xs:restriction>
        </xs:simpleType>
      </xs:element>
      <xs:element name="MP" minOccurs="0">
        <xs:simpleType>
          <xs:restriction base="xs:string">
            <xs:maxLength value="1" />
          </xs:restriction>
        </xs:simpleType>
      </xs:element>
      <xs:element name="FP" minOccurs="0">
        <xs:simpleType>
          <xs:restriction base="xs:string">
            <xs:maxLength value="25" />
          </xs:restriction>
        </xs:simpleType>
      </xs:element>
      <xs:element name="TechName" minOccurs="0">
        <xs:simpleType>
          <xs:restriction base="xs:string">
            <xs:maxLength value="1" />
          </xs:restriction>
        </xs:simpleType>
      </xs:element>
      <xs:element name="TreatAs" minOccurs="0">
        <xs:simpleType>
          <xs:restriction base="xs:string">
            <xs:maxLength value="5" />
          </xs:restriction>
        </xs:simpleType>
      </xs:element>
      <xs:element name="DglPhrase" minOccurs="0">
        <xs:simpleType>
          <xs:restriction base="xs:string">
            <xs:maxLength value="20" />
          </xs:restriction>
        </xs:simpleType>
      </xs:element>
      <xs:element name="PackIns" minOccurs="0">
        <xs:simpleType>
          <xs:restriction base="xs:string">
            <xs:maxLength value="20" />
          </xs:restriction>
        </xs:simpleType>
      </xs:element>
      <xs:element name="PackProv" minOccurs="0">
        <xs:simpleType>
          <xs:restriction base="xs:string">
            <xs:maxLength value="24" />
          </xs:restriction>
        </xs:simpleType>
      </xs:element>
      <xs:element name="IBCIns" minOccurs="0">
        <xs:simpleType>
          <xs:restriction base="xs:string">
            <xs:maxLength value="6" />
          </xs:restriction>
        </xs:simpleType>
      </xs:element>
      <xs:element name="IBCProv" minOccurs="0">
        <xs:simpleType>
          <xs:restriction base="xs:string">
            <xs:maxLength value="9" />
          </xs:restriction>
        </xs:simpleType>
      </xs:element>
      <xs:element name="IMOTankIns" minOccurs="0">
        <xs:simpleType>
          <xs:restriction base="xs:string">
            <xs:maxLength value="8" />
          </xs:restriction>
        </xs:simpleType>
      </xs:element>
      <xs:element name="UNTankIns" minOccurs="0">
        <xs:simpleType>
          <xs:restriction base="xs:string">
            <xs:maxLength value="4" />
          </xs:restriction>
        </xs:simpleType>
      </xs:element>
      <xs:element name="TankProv" minOccurs="0">
        <xs:simpleType>
          <xs:restriction base="xs:string">
            <xs:maxLength value="24" />
          </xs:restriction>
        </xs:simpleType>
      </xs:element>
      <xs:element name="Markers" minOccurs="0">
        <xs:simpleType>
          <xs:restriction base="xs:string">
            <xs:maxLength value="5" />
          </xs:restriction>
        </xs:simpleType>
      </xs:element>
      <xs:element name="Pointers" minOccurs="0">
        <xs:simpleType>
          <xs:restriction base="xs:string">
            <xs:maxLength value="8" />
          </xs:restriction>
        </xs:simpleType>
      </xs:element>
      <xs:element name="EXVector" minOccurs="0">
        <xs:simpleType>
          <xs:restriction base="xs:string">
            <xs:maxLength value="17" />
          </xs:restriction>
        </xs:simpleType>
      </xs:element>
      <xs:element name="StowCat" minOccurs="0">
        <xs:simpleType>
          <xs:restriction base="xs:string">
            <xs:maxLength value="2" />
          </xs:restriction>
        </xs:simpleType>
      </xs:element>
      <xs:element name="CodedStow" minOccurs="0">
        <xs:simpleType>
          <xs:restriction base="xs:string">
            <xs:maxLength value="52" />
          </xs:restriction>
        </xs:simpleType>
      </xs:element>
      <xs:element name="State" minOccurs="0">
        <xs:simpleType>
          <xs:restriction base="xs:string">
            <xs:maxLength value="1" />
          </xs:restriction>
        </xs:simpleType>
      </xs:element>
      <xs:element name="ExpLim" minOccurs="0">
        <xs:simpleType>
          <xs:restriction base="xs:string">
            <xs:maxLength value="26" />
          </xs:restriction>
        </xs:simpleType>
      </xs:element>
      <xs:element name="UlineEMS" minOccurs="0">
        <xs:simpleType>
          <xs:restriction base="xs:string">
            <xs:maxLength value="1" />
          </xs:restriction>
        </xs:simpleType>
      </xs:element>
      <xs:element name="Code" minOccurs="0">
        <xs:simpleType>
          <xs:restriction base="xs:string">
            <xs:maxLength value="5" />
          </xs:restriction>
        </xs:simpleType>
      </xs:element>
      <xs:element name="UsrUSDOTShippingName" minOccurs="0">
        <xs:simpleType>
          <xs:restriction base="xs:string">
            <xs:maxLength value="100" />
          </xs:restriction>
        </xs:simpleType>
      </xs:element>
      <xs:element name="LQMaxAmt" minOccurs="0" type="xs:decimal" />
      <xs:element name="LQMaxAmtUQ" minOccurs="0">
        <xs:simpleType>
          <xs:restriction base="xs:string">
            <xs:maxLength value="2" />
          </xs:restriction>
        </xs:simpleType>
      </xs:element>
      <xs:element name="LQSpecProvIndex" minOccurs="0" type="xs:int" />
      <xs:element name="ExceptedQuantityCode" minOccurs="0">
        <xs:simpleType>
          <xs:restriction base="xs:string">
            <xs:maxLength value="2" />
          </xs:restriction>
        </xs:simpleType>
      </xs:element>
      <xs:element name="IsActive" minOccurs="0" type="xs:boolean" />
      <xs:element name="IsSystem" minOccurs="0" type="xs:boolean" />
      <xs:element name="UNDGAttributeCollection" minOccurs="0">
        <xs:complexType>
          <xs:sequence>
            <xs:element name="UNDGAttribute" minOccurs="0" maxOccurs="unbounded">
              <xs:complexType>
                <xs:all>
                  <!-- Candidate Key: UNDGSubstance.PK + Language + Type + Index -->
                  <xs:element name="PK" minOccurs="0" type="xs:string" />
                  <xs:element name="Language" minOccurs="0">
                    <xs:simpleType>
                      <xs:restriction base="xs:string">
                        <xs:maxLength value="7" />
                      </xs:restriction>
                    </xs:simpleType>
                  </xs:element>
                  <xs:element name="Type" minOccurs="0">
                    <xs:simpleType>
                      <xs:restriction base="xs:string">
                        <xs:maxLength value="3" />
                      </xs:restriction>
                    </xs:simpleType>
                  </xs:element>
                  <xs:element name="Index" minOccurs="0" type="xs:int" />
                  <xs:element name="Descriptor" minOccurs="0">
                    <xs:simpleType>
                      <xs:restriction base="xs:string" />
                    </xs:simpleType>
                  </xs:element>
                  <xs:element name="IsSystem" minOccurs="0" type="xs:boolean" />
                </xs:all>
                <xs:attribute name="Action" type="Action" />
              </xs:complexType>
            </xs:element>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
    </xs:all>
    <xs:attribute name="Action" type="Action" />
  </xs:complexType>
</xs:schema>
