<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified" version="1.00"
           xmlns:emcs="urn:publicid:-:EC:DGTAXUD:EMCS:PHASE3:EMCS:V2.02"
           xmlns:doc="urn:publicid:-:EC:DGTAXUD:EMCS:PHASE3:DOC:V2.02"
           xmlns:tcl="urn:publicid:-:EC:DGTAXUD:EMCS:PHASE3:TCL:V2.02"
           xmlns:emcstypes="http://www.mf.gov.pl/schematy/EMCSPL3/EMCSTYPES/2019/10/"
           xmlns:pltypes="http://www.mf.gov.pl/schematy/EAD/PLTYPES/2019/10/"
           targetNamespace="http://www.mf.gov.pl/schematy/EAD/PLTYPES/2019/10/" >
  <!--=========================================================-->
  <!--===    EMCSPL - definicje typów prostych lub typów    ===-->
  <!--=== złożonych zdefiniowanych dla polskich komunikatów ===-->
  <!--=========================================================-->

  <xs:import namespace="urn:publicid:-:EC:DGTAXUD:EMCS:PHASE3:EMCS:V2.02"    schemaLocation="types.xsd" />
  <xs:import namespace="http://www.mf.gov.pl/schematy/EMCSPL3/EMCSTYPES/2019/10/" schemaLocation="emcsTypes.xsd"/>
  <xs:import namespace="urn:publicid:-:EC:DGTAXUD:EMCS:PHASE3:TCL:V2.02"     schemaLocation="tcl.xsd" />

  <!--==========================================================-->
  <!--=====             Local Reference Number             =====-->
  <!--==========================================================-->
  <xs:simpleType name="LocalReferenceNumberType">
    <xs:annotation>
      <xs:documentation>
        <doc:description value="Local Reference Number" />
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:token">
      <xs:length value="20" />
      <xs:pattern value="[0-9]{9}[A-Z0-9][0-9]{10}" />
    </xs:restriction>
  </xs:simpleType>

  <!--==========================================================-->
  <!--===                 Maximum retail price               ===-->
  <!--==========================================================-->
  <xs:simpleType name="MaxRetailPriceType">
    <xs:annotation>
      <xs:documentation xml:lang="pl" >
        Maksymalna cena detaliczna za 20 szt. lub za kilogram
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:decimal">
      <xs:totalDigits value="5" />
      <xs:fractionDigits value="2" />
      <xs:minInclusive value="0" />
    </xs:restriction>
  </xs:simpleType>

  <!--==========================================================-->
  <!--=====                  Movement Code                 =====-->
  <!--==========================================================-->
  <xs:simpleType name="MovementCodeType">
    <xs:annotation>
      <xs:documentation>Kod przemieszczenia</xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:token">
      <xs:enumeration value="A">
        <xs:annotation>
          <xs:documentation>Przemieszczenie na terytorium Polski alkoholu etylowego objętego pozycją CN 2207</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="R">
        <xs:annotation>
          <xs:documentation>Przemieszczanie rurociągiem ropopochodnych wyrobów akcyzowych pomiędzy składami podatkowymi</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="K">
        <xs:annotation>
          <xs:documentation>Przemieszczenie na terytorium Polski inne niż "A" i "R"</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="U">
        <xs:annotation>
          <xs:documentation>Przemieszczenie na terytorium UE inne niż "R"</xs:documentation>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>

  <!--==========================================================-->
  <!--=====                   Place Name                   =====-->
  <!--==========================================================-->
  <xs:simpleType name="PlaceNameType">
    <xs:annotation>
      <xs:documentation>Nazwa miejsca</xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:token">
      <xs:maxLength value="182" />
      <xs:pattern value=".{1,182}" />
    </xs:restriction>
  </xs:simpleType>

  <!--==========================================================-->
  <!--=====                    Body Ead                    =====-->
  <!--==========================================================-->
  <xs:complexType name="BodyEadType">
    <xs:annotation>
      <xs:documentation>
        <doc:description xml:lang="pl" value="17a e-AD Wyroby" />
      </xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="BodyRecordUniqueReference" type="emcs:BodyRecordUniqueReferenceType" />
      <xs:element name="ExciseProductCode" type="emcs:ExciseProductCodeType" />
      <xs:element name="CnCode" type="emcs:CnCodeType" />
      <xs:element name="Quantity" type="emcs:QuantityType" />
      <xs:element name="AdditionalQuantity" type="emcs:QuantityType" minOccurs="0" />
      <xs:element name="GrossWeight" type="emcs:GrossWeightType" />
      <xs:element name="NetWeight" type="emcs:NetWeightType" />
      <xs:element name="AlcoholicStrengthByVolumeInPercentage" type="emcs:AlcoholicStrengthType" minOccurs="0" />
      <xs:element name="DegreePlato" type="emcs:DegreePlatoType" minOccurs="0" />
      <xs:element name="FuelType" type="emcstypes:FuelTypeType" minOccurs="0" />
      <xs:element name="NotColouredAndMarkedFuelOils" type="tcl:Flag" minOccurs="0" />
      <xs:element name="BiofuelContentMeetsQualityRequirements" type="tcl:Flag" minOccurs="0" />
      <xs:element name="MaxRetailPrice" type="pltypes:MaxRetailPriceType" minOccurs="0" />
      <xs:element name="FiscalMark" type="pltypes:LSDFiscalMarkType" minOccurs="0" />
      <xs:element name="FiscalMarkUsedFlag" type="tcl:Flag" minOccurs="0" />
      <xs:element name="DesignationOfOrigin" type="pltypes:LSDDesignationOfOriginType" minOccurs="0" />
      <xs:element name="SizeOfProducer" type="emcs:SizeOfProducerType" minOccurs="0" />
      <xs:element name="Density" type="emcs:DensityType" minOccurs="0" />
      <xs:element name="CommercialDescription" type="pltypes:LSDCommercialDescriptionType" minOccurs="0" />
      <xs:element name="BrandNameOfProducts" type="pltypes:LSDBrandNameOfProductsType" minOccurs="0" />
      <xs:element name="ZeroRatedExciseTax" type="tcl:Flag" minOccurs="0" />
    </xs:sequence>
  </xs:complexType>

  <!--==========================================================-->
  <!--=====                 Customs Office                 =====-->
  <!--==========================================================-->
  <xs:complexType name="CustomsOfficeType">
    <xs:annotation>
      <xs:documentation>
        <doc:description value="Urząd" />
      </xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="ReferenceNumber" type="emcs:ExciseOfficeCodeType" />
    </xs:sequence>
  </xs:complexType>

  <!--==========================================================-->
  <!--=====           Complement Consignee Trader          =====-->
  <!--==========================================================-->
  <xs:complexType name="ComplementConsigneeTraderType">
    <xs:annotation>
      <xs:documentation>
        <doc:description value="Podmiot odbierający uzupełnienie" />
      </xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="MemberStateCode" type="emcs:CountryCodeType" />
      <xs:element name="SerialNumberOfCertificateOfExemption" type="emcs:SerialNumberOfCertificateOfExemptionType" minOccurs="0" />
    </xs:sequence>
  </xs:complexType>

  <!--==========================================================-->
  <!--=====                Consignee Trader                =====-->
  <!--==========================================================-->
  <xs:complexType name="ConsigneeTraderType">
    <xs:annotation>
      <xs:documentation>
        <doc:description value="Podmiot odbierający" />
      </xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="Traderid" type="emcs:TraderidType" minOccurs="0" />
      <xs:element name="TraderName" type="emcs:TraderNameType" />
      <xs:element name="StreetName" type="emcs:StreetNameType" />
      <xs:element name="StreetNumber" type="emcs:StreetNumberType" minOccurs="0" />
      <xs:element name="Postcode" type="emcs:PostcodeType" />
      <xs:element name="City" type="emcs:CityType" />
      <xs:element name="EoriNumber" type="emcs:EoriNumberType" minOccurs="0" />
    </xs:sequence>
    <xs:attribute name="language" type="emcs:LanguageCodeType" use="required" />
  </xs:complexType>

  <!--==========================================================-->
  <!--=====                Consignor Trader                =====-->
  <!--==========================================================-->
  <xs:complexType name="ConsignorTraderType">
    <xs:annotation>
      <xs:documentation>
        <doc:description value="Podmiot wysyłający" />
      </xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="TraderExciseNumber" type="emcs:ExciseNumberType" />
      <xs:element name="TraderName" type="emcs:TraderNameType" />
      <xs:element name="StreetName" type="emcs:StreetNameType" />
      <xs:element name="StreetNumber" type="emcs:StreetNumberType" minOccurs="0" />
      <xs:element name="Postcode" type="emcs:PostcodeType" />
      <xs:element name="City" type="emcs:CityType" />
    </xs:sequence>
    <xs:attribute name="language" type="emcs:LanguageCodeType" use="required" />
  </xs:complexType>

  <!--==========================================================-->
  <!--=====              Delivery Place Trader             =====-->
  <!--==========================================================-->
  <xs:complexType name="DeliveryPlaceTraderType">
    <xs:sequence>
      <xs:element name="Traderid" type="emcs:TraderidType" minOccurs="0" />
      <xs:element name="TraderName" type="emcs:TraderNameType" minOccurs="0" />
      <xs:element name="StreetName" type="emcs:StreetNameType" minOccurs="0" />
      <xs:element name="StreetNumber" type="emcs:StreetNumberType" minOccurs="0" />
      <xs:element name="Postcode" type="emcs:PostcodeType" minOccurs="0" />
      <xs:element name="City" type="emcs:CityType" minOccurs="0" />
    </xs:sequence>
    <xs:attribute name="language" type="emcs:LanguageCodeType" use="optional" />
  </xs:complexType>

  <!--==========================================================-->
  <!--=====               Excise Movement Ead              =====-->
  <!--==========================================================-->
  <xs:complexType name="ExciseMovementEadType">
    <xs:annotation>
      <xs:documentation>
        <doc:description value="Przemieszczenie e-AD" />
      </xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="AdministrativeReferenceCode" type="emcs:AdministrativeReferenceCodeType" />
      <xs:element name="SequenceNumber" type="emcs:SequenceNumberType" />
    </xs:sequence>
  </xs:complexType>

  <!--==========================================================-->
  <!--=====                Guarantor Trader                =====-->
  <!--==========================================================-->
  <xs:complexType name="GuarantorTraderType">
    <xs:annotation>
      <xs:documentation>
        <doc:description value="Gwarant" />
      </xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="TraderExciseNumber" type="emcs:ExciseNumberType" minOccurs="0" />
      <xs:element name="TraderName" type="emcs:TraderNameType" minOccurs="0" />
      <xs:element name="StreetName" type="emcs:StreetNameType" minOccurs="0" />
      <xs:element name="StreetNumber" type="emcs:StreetNumberType" minOccurs="0" />
      <xs:element name="City" type="emcs:CityType" minOccurs="0" />
      <xs:element name="Postcode" type="emcs:PostcodeType" minOccurs="0" />
      <xs:element name="VatNumber" type="emcs:VatNumberType" />
    </xs:sequence>
    <xs:attribute name="language" type="emcs:LanguageCodeType" use="optional" />
  </xs:complexType>

  <!--==========================================================-->
  <!--=====                   Header Ead                   =====-->
  <!--==========================================================-->
  <xs:complexType name="HeaderEadType">
    <xs:sequence>
      <xs:element name="DestinationTypeCode" type="tcl:DestinationTypeCode" />
      <xs:element name="JourneyTime" type="emcs:JourneyTimeType" />
      <xs:element name="TransportArrangement" type="tcl:TransportArrangement" />
    </xs:sequence>
  </xs:complexType>

  <!--==========================================================-->
  <!--=====           LSD Brand Name Of Products           =====-->
  <!--==========================================================-->
  <xs:complexType name="LSDBrandNameOfProductsType">
    <xs:simpleContent>
      <xs:extension base="emcs:BrandNameOfProductsType">
        <xs:attribute name="language" type="emcs:LanguageCodeType" use="required" />
      </xs:extension>
    </xs:simpleContent>
  </xs:complexType>

  <!--==========================================================-->
  <!--=====           LSD Commercial Description           =====-->
  <!--==========================================================-->
  <xs:complexType name="LSDCommercialDescriptionType">
    <xs:simpleContent>
      <xs:extension base="emcs:CommercialDescriptionType">
        <xs:attribute name="language" type="emcs:LanguageCodeType" use="required" />
      </xs:extension>
    </xs:simpleContent>
  </xs:complexType>

  <!--==========================================================-->
  <!--=====         LSD Complementary Information          =====-->
  <!--==========================================================-->
  <xs:complexType name="LSDComplementaryInformationType">
    <xs:simpleContent>
      <xs:extension base="emcs:ComplementaryInformationType">
        <xs:attribute name="language" type="emcs:LanguageCodeType" use="required" />
      </xs:extension>
    </xs:simpleContent>
  </xs:complexType>

  <!--==========================================================-->
  <!--=====            LSD Designation Of Origin           =====-->
  <!--==========================================================-->
  <xs:complexType name="LSDDesignationOfOriginType">
    <xs:simpleContent>
      <xs:extension base="emcs:DesignationOfOriginType">
        <xs:attribute name="language" type="emcs:LanguageCodeType" use="required" />
      </xs:extension>
    </xs:simpleContent>
  </xs:complexType>

  <!--==========================================================-->
  <!--=====                LSD Fiscal Mark                 =====-->
  <!--==========================================================-->
  <xs:complexType name="LSDFiscalMarkType">
    <xs:simpleContent>
      <xs:extension base="emcs:FiscalMarkType">
        <xs:attribute name="language" type="emcs:LanguageCodeType" use="required" />
      </xs:extension>
    </xs:simpleContent>
  </xs:complexType>

  <!--==========================================================-->
  <!--=====              LSD Seal Information              =====-->
  <!--==========================================================-->
  <xs:complexType name="LSDSealInformationType">
    <xs:simpleContent>
      <xs:extension base="emcs:SealInformationType">
        <xs:attribute name="language" type="emcs:LanguageCodeType" use="required" />
      </xs:extension>
    </xs:simpleContent>
  </xs:complexType>

  <!--==========================================================-->
  <!--=====                    Package                     =====-->
  <!--==========================================================-->
  <xs:complexType name="PackageType">
    <xs:annotation>
      <xs:documentation>
        <doc:description value="Opakowanie" />
      </xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="KindOfPackages" type="emcs:KindOfPackagesType" />
      <xs:element name="NumberOfPackages" type="emcs:NumberOfPackagesType" minOccurs="0" />
      <xs:element name="ShippingMarks" type="emcs:ShippingMarksType" minOccurs="0" />
      <xs:element name="CommercialSealIdentification" type="emcs:CommercialSealIdentificationType" minOccurs="0" />
      <xs:element name="SealInformation" type="pltypes:LSDSealInformationType" minOccurs="0" />
    </xs:sequence>
  </xs:complexType>

  <!--==========================================================-->
  <!--=====            Place Of Dispatch Trader            =====-->
  <!--==========================================================-->
  <xs:complexType name="PlaceOfDispatchTraderType">
    <xs:annotation>
      <xs:documentation>
        <doc:description value="Podmiot miejsce wysyłki" />
      </xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="ReferenceOfTaxWarehouse" type="emcs:ExciseNumberType" />
      <xs:element name="TraderName" type="emcs:TraderNameType" minOccurs="0" />
      <xs:element name="StreetName" type="emcs:StreetNameType" minOccurs="0" />
      <xs:element name="StreetNumber" type="emcs:StreetNumberType" minOccurs="0" />
      <xs:element name="Postcode" type="emcs:PostcodeType" minOccurs="0" />
      <xs:element name="City" type="emcs:CityType" minOccurs="0" />
    </xs:sequence>
    <xs:attribute name="language" type="emcs:LanguageCodeType" use="optional" />
  </xs:complexType>

  <!--==========================================================-->
  <!--=====              Place Of Transhipment             =====-->
  <!--==========================================================-->
  <xs:complexType name="PlaceOfTranshipmentType">
    <xs:annotation>
      <xs:documentation>
        <doc:description value="Miejsce przeładunku wyrobów" />
      </xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="PlaceName" type="pltypes:PlaceNameType" minOccurs="0" />
      <xs:element name="StreetName" type="emcs:StreetNameType" />
      <xs:element name="StreetNumber" type="emcs:StreetNumberType" minOccurs="0" />
      <xs:element name="Postcode" type="emcs:PostcodeType" />
      <xs:element name="City" type="emcs:CityType" />
    </xs:sequence>
  </xs:complexType>

  <!--==========================================================-->
  <!--=====                Transport Details               =====-->
  <!--==========================================================-->
  <xs:complexType name="TransportDetailsType">
    <xs:annotation>
      <xs:documentation>
        <doc:description value="Detale transportu" />
      </xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="TransportUnitCode" type="emcs:TransportUnitCodeType" />
      <xs:element name="IdentityOfTransportUnits" type="emcs:IdentityOfTransportUnitsType" minOccurs="0" />
      <xs:element name="CommercialSealIdentification" type="emcs:CommercialSealIdentificationType" minOccurs="0" />
      <xs:element name="ComplementaryInformation" type="pltypes:LSDComplementaryInformationType" minOccurs="0" />
      <xs:element name="SealInformation" type="pltypes:LSDSealInformationType" minOccurs="0" />
    </xs:sequence>
  </xs:complexType>

  <!--==========================================================-->
  <!--=====                Transport Trader                =====-->
  <!--==========================================================-->
  <xs:complexType name="TransportTraderType">
    <xs:annotation>
      <xs:documentation>
        <doc:description value="Podmiot przewoźnik/organizator" />
      </xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="VatNumber" type="emcs:VatNumberType" />
      <xs:element name="TraderName" type="emcs:TraderNameType" />
      <xs:element name="StreetName" type="emcs:StreetNameType" />
      <xs:element name="StreetNumber" type="emcs:StreetNumberType" minOccurs="0" />
      <xs:element name="Postcode" type="emcs:PostcodeType" />
      <xs:element name="City" type="emcs:CityType" />
    </xs:sequence>
    <xs:attribute name="language" type="emcs:LanguageCodeType" use="required" />
  </xs:complexType>

</xs:schema>
