<?xml version="1.0" encoding="utf-8"?>
<xs:schema elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:element name="materialList" nillable="true" type="MaterialList" />
  <xs:complexType name="MaterialList">
    <xs:sequence>
      <xs:element minOccurs="0" maxOccurs="1" name="version" nillable="true" type="xs:string" />
      <xs:element minOccurs="1" maxOccurs="1" name="itemId" nillable="true" type="xs:string">
        <xs:annotation>
          <xs:documentation>External reference of the item (as known in CAS in article master data). Unique identifier of the produced item</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element minOccurs="1" maxOccurs="1" name="externalReference" nillable="true" type="xs:string">
        <xs:annotation>
          <xs:documentation>Unique external reference of the material list</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element minOccurs="0" maxOccurs="1" name="documentReference" nillable="true" type="xs:string">
        <xs:annotation>
          <xs:documentation>Reference to the document that triggered the creation of material list</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element minOccurs="0" maxOccurs="1" name="serialBatchReference" nillable="true" type="xs:string">
        <xs:annotation>
          <xs:documentation>Unique serial or batch number of the (semi-)produced product
            E.g. VIN number</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element minOccurs="0" maxOccurs="1" name="productionDate" nillable="true" type="xs:string" />
      <xs:element minOccurs="1" maxOccurs="1" name="quantity" nillable="true" type="xs:decimal">
        <xs:annotation>
          <xs:documentation>Quantity of the (semi-)produced product</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element minOccurs="1" maxOccurs="1" name="uom" nillable="true" type="xs:string">
        <xs:annotation>
          <xs:documentation>Unit of measure in which the quantity is defined</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element minOccurs="1" maxOccurs="1" name="storageLocationReference" nillable="true" type="xs:string">
        <xs:annotation>
          <xs:documentation>Storage location reference (as known in CAS)</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element minOccurs="1" maxOccurs="1" name="processingType" nillable="true" type="ProcessingTypeEnum" />
      <xs:element minOccurs="1" maxOccurs="1" name="materialListLines" type="ArrayOfMaterialListLine" />
      <xs:element minOccurs="1" maxOccurs="1" name="byProducts" type="ArrayOfMaterialListLine1" />
    </xs:sequence>
  </xs:complexType>
  <xs:simpleType name="ProcessingTypeEnum">
    <xs:restriction base="xs:string">
      <xs:enumeration value="0" />
      <xs:enumeration value="1" />
      <xs:enumeration value="2" />
      <xs:enumeration value="4" />
      <xs:enumeration value="5" />
    </xs:restriction>
  </xs:simpleType>
  <xs:complexType name="ArrayOfMaterialListLine">
    <xs:sequence>
      <xs:element minOccurs="0" maxOccurs="unbounded" name="materialListLine" nillable="true" type="MaterialListLine" />
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="MaterialListLine">
    <xs:sequence>
      <xs:element minOccurs="1" maxOccurs="1" name="itemId" nillable="true" type="xs:string">
        <xs:annotation>
          <xs:documentation>Unique technical identifier of the material list line</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element minOccurs="0" maxOccurs="1" name="serialBatchReference" nillable="true" type="xs:string">
        <xs:annotation>
          <xs:documentation>Unique serial or batch number of the semi-finished product</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element minOccurs="1" maxOccurs="1" name="quantity" nillable="true" type="xs:decimal">
        <xs:annotation>
          <xs:documentation>Quantity of the material/semi-finished product</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element minOccurs="1" maxOccurs="1" name="uom" nillable="true" type="xs:string">
        <xs:annotation>
          <xs:documentation>Unit of measure in which the quantity is defined</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element minOccurs="0" maxOccurs="1" name="storageLocationReference" nillable="true" type="xs:string">
        <xs:annotation>
          <xs:documentation>Storage location reference (as known in CAS)</xs:documentation>
        </xs:annotation>
      </xs:element>
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="ArrayOfMaterialListLine1">
    <xs:sequence>
      <xs:element minOccurs="0" maxOccurs="unbounded" name="byProduct" nillable="true" type="MaterialListLine" />
    </xs:sequence>
  </xs:complexType>
</xs:schema>