<?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:tms="urn:publicid:-:EC:DGTAXUD:EMCS:PHASE3:TMS:V2.02"
           xmlns:tcl="urn:publicid:-:EC:DGTAXUD:EMCS:PHASE3:TCL:V2.02"
           xmlns:doc="urn:publicid:-:EC:DGTAXUD:EMCS:PHASE3:DOC: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/"
           xmlns:ie="http://www.mf.gov.pl/schematy/EAD/PL818/2019/10/"
           targetNamespace="http://www.mf.gov.pl/schematy/EAD/PL818/2019/10/">
  <!--=========================================================-->
  <!--==================== PL818:C_DEL_DAT ====================-->
  <!--===== ACCEPTED OR REJECTED REPORT OF RECEIPT/EXPORT =====-->
  <!--=========================================================-->
  <!--===== Imports =====-->
  <xs:import namespace="http://www.mf.gov.pl/schematy/EMCSPL3/EMCSTYPES/2019/10/" schemaLocation="emcsTypes.xsd" />
  <xs:import namespace="http://www.mf.gov.pl/schematy/EAD/PLTYPES/2019/10/" schemaLocation="plTypes.xsd" />
  <xs:import namespace="urn:publicid:-:EC:DGTAXUD:EMCS:PHASE3:EMCS:V2.02" schemaLocation="types.xsd" />
  <xs:import namespace="urn:publicid:-:EC:DGTAXUD:EMCS:PHASE3:TMS:V2.02" schemaLocation="tms.xsd" />
  <xs:import namespace="urn:publicid:-:EC:DGTAXUD:EMCS:PHASE3:TCL:V2.02" schemaLocation="tcl.xsd" />
  <xs:import namespace="urn:publicid:-:EC:DGTAXUD:EMCS:PHASE3:DOC:V2.02" schemaLocation="doc.xsd" />

  <!--===== Root Element =====-->
  <xs:element name="PL818" type="ie:PL818Type" />

  <!--===== EMCS Data Groups Declarations =====-->
  <xs:complexType name="PL818Type">
    <xs:sequence>
      <xs:element name="Header" type="tms:HeaderType" />
      <xs:element name="Body" type="ie:BodyType" />
    </xs:sequence>
  </xs:complexType>
  <!--===== IE Specific Data Groups Declarations =====-->
  <xs:complexType name="BodyType">
    <xs:sequence>
      <xs:element name="AcceptedOrRejectedReportOfReceiptExportWithGuarantee" type="ie:AcceptedOrRejectedReportOfReceiptExportWithGuaranteeType" />
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="AcceptedOrRejectedReportOfReceiptExportWithGuaranteeType">
    <xs:sequence>
      <xs:element name="Attributes" type="ie:AttributesType" />
      <xs:element name="ConsigneeTrader" type="pltypes:ConsigneeTraderType" minOccurs="0" />
      <xs:element name="ExciseMovementEad" type="pltypes:ExciseMovementEadType" />
      <xs:element name="DeliveryPlaceTrader" type="pltypes:DeliveryPlaceTraderType" minOccurs="0" />
      <xs:element name="DestinationOffice" type="pltypes:CustomsOfficeType" minOccurs="0" />
      <xs:element name="MovementGuarantee" type="ie:MovementGuaranteeType" maxOccurs="1" minOccurs="0" />
      <xs:element name="ReportOfReceiptExport" type="ie:ReportOfReceiptExportType" />
      <xs:element name="BodyReportOfReceiptExport" type="ie:BodyReportOfReceiptExportType" minOccurs="0" maxOccurs="unbounded" />
      <xs:element name="ReportOfReceiptSupplement" type="ie:ReportOfReceiptSupplementType" minOccurs="0" />
      <xs:element name="IntraCommunityAcquisitionOfGoods" type="ie:IntraCommunityAcquisitionOfGoodsType" minOccurs="0" />
    </xs:sequence>
  </xs:complexType>

  <!--==========================================================-->
  <!--=====                   Attributes                   =====-->
  <!--==========================================================-->
  <xs:complexType name="AttributesType">
    <xs:sequence>
      <xs:element name="DateAndTimeOfValidationOfReportOfReceiptExport" type="emcs:DateTimeType" minOccurs="0" />
    </xs:sequence>
  </xs:complexType>

  <!--==========================================================-->
  <!--=====            Report Of Receipt Export            =====-->
  <!--==========================================================-->
  <xs:complexType name="ReportOfReceiptExportType">
    <xs:annotation>
      <xs:documentation>
        <doc:description value="REPORT OF RECEIPT/EXPORT" />
      </xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="DateOfArrivalOfExciseProducts" type="emcs:DateType" />
      <xs:element name="GlobalConclusionOfReceipt" type="tcl:GlobalConclusionOfReceipt" />
      <xs:element name="ComplementaryInformation" type="pltypes:LSDComplementaryInformationType" minOccurs="0" />
    </xs:sequence>
  </xs:complexType>

  <!--==========================================================-->
  <!--=====         Body Report Of Receipt Export          =====-->
  <!--==========================================================-->
  <xs:complexType name="BodyReportOfReceiptExportType">
    <xs:annotation>
      <xs:documentation>
        <doc:description value="(BODY) REPORT OF RECEIPT/EXPORT" />
      </xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="BodyRecordUniqueReference" type="emcs:BodyRecordUniqueReferenceType" />
      <xs:element name="IndicatorOfShortageOrExcess" type="tcl:IndicatorOfShortageOrExcess" minOccurs="0" />
      <xs:element name="ObservedShortageOrExcess" type="emcs:ObservedShortageOrExcessType" minOccurs="0" />
      <xs:element name="ExciseProductCode" type="emcs:ExciseProductCodeType" />
      <xs:element name="RefusedQuantity" type="emcs:RefusedQuantityType" minOccurs="0" />
      <xs:element name="UnsatisfactoryReason" type="ie:UnsatisfactoryReasonType" minOccurs="0" maxOccurs="9" />
    </xs:sequence>
  </xs:complexType>

  <!--==========================================================-->
  <!--=====             Unsatisfactory Reason              =====-->
  <!--==========================================================-->
  <xs:complexType name="UnsatisfactoryReasonType">
    <xs:annotation>
      <xs:documentation>
        <doc:description value="UNSATISFACTORY REASON" />
      </xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="UnsatisfactoryReasonCode" type="emcs:UnsatisfactoryReasonCodeType" />
      <xs:element name="ComplementaryInformation" type="pltypes:LSDComplementaryInformationType" minOccurs="0" />
    </xs:sequence>
  </xs:complexType>

  <!--==========================================================-->
  <!--=====          Report Of Receipt Supplement          =====-->
  <!--==========================================================-->
  <xs:complexType name="ReportOfReceiptSupplementType">
    <xs:annotation>
      <xs:documentation>
        <doc:description value="REPORT OF RECEIPT SUPPLEMENT" />
      </xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="BodyReportOfReceiptSupplement" type="ie:BodyReportOfReceiptSupplementType" maxOccurs="999"/>
    </xs:sequence>
  </xs:complexType>

  <!--==========================================================-->
  <!--=====       Body Report Of Receipt Supplement        =====-->
  <!--==========================================================-->
  <xs:complexType name="BodyReportOfReceiptSupplementType">
    <xs:annotation>
      <xs:documentation>
        <doc:description value="(BODY) REPORT OF RECEIPT SUPPLEMENT" />
      </xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="BodyRecordUniqueReference" type="emcs:BodyRecordUniqueReferenceType" />
      <xs:element name="ZeroRatedExciseTax" type="tcl:Flag" minOccurs="0" />
      <xs:element name="MaxRetailPrice" type="pltypes:MaxRetailPriceType" minOccurs="0" />
      <xs:element name="FiscalMarkUsedFlag" type="tcl:Flag" minOccurs="0" />
      <xs:element name="BiofuelContentMeetsQualityRequirements" type="tcl:Flag" minOccurs="0" />
      <xs:element name="NotColouredAndMarkedFuelOils" type="tcl:Flag" minOccurs="0" />
      <xs:element name="FuelType" type="emcstypes:FuelTypeType" minOccurs="0" />
      <xs:element name="AdditionalQuantity" type="emcs:QuantityType" minOccurs="0" />
    </xs:sequence>
  </xs:complexType>

  <!--==========================================================-->
  <!--=====               Movement Guarantee               =====-->
  <!--==========================================================-->
  <xs:complexType name="MovementGuaranteeType">
    <xs:annotation>
      <xs:documentation>
        <doc:description xml:lang="pl" value="MovementGuarantee" />
      </xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="GuaranteeReferenceNumber" type="emcstypes:GuaranteeReferenceNumberType" />
      <xs:element name="GuaranteeReferenceNumberAccessCode" type="emcstypes:GuaranteeReferenceNumberAccessCodeType" />
      <xs:element name="ConsigneeTIN" type="emcstypes:TINType"/>
    </xs:sequence>
  </xs:complexType>

  <!--==========================================================-->
  <!--=====      Intra Community Acquisition Of Goods      =====-->
  <!--==========================================================-->
  <xs:complexType name="IntraCommunityAcquisitionOfGoodsType">
    <xs:annotation>
      <xs:documentation>
        <doc:description value="Dane podmiotu dla nabycia wewnątrzwspólnotowego" />
      </xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="DomesticTrader" type="ie:DomesticTraderType" minOccurs="0" maxOccurs="unbounded" />
      <xs:element name="ForeignTrader" type="ie:ForeignTraderType" minOccurs="0" maxOccurs="unbounded" />
    </xs:sequence>
  </xs:complexType>

  <!--==========================================================-->
  <!--=====                    Product                     =====-->
  <!--==========================================================-->
  <xs:complexType name="ProductType">
    <xs:annotation>
      <xs:documentation>
        <doc:description value="Dane o produktach dla nabycia wewnątrzwspólnotowego" />
      </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:sequence>
  </xs:complexType>

  <!--==========================================================-->
  <!--=====                 Foreign Trader                 =====-->
  <!--==========================================================-->
  <xs:complexType name="ForeignTraderType">
    <xs:annotation>
      <xs:documentation>
        <doc:description value="Dane podmiotu zagranicznego dla nabycia wewnątrzwspólnotowego" />
      </xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="TaxNumber" type="ie:TaxNumberForeignType"/>
      <xs:element name="NationalCourtRegisterId" type="ie:NationalCourtRegisterIdType"/>
      <xs:element name="TraderAddress" type="ie:TraderAddressType"/>
      <xs:element name="TraderBranchAddress" type="ie:TraderBranchAddressType"/>
      <xs:element name="Product" type="ie:ProductType" maxOccurs="unbounded" />
    </xs:sequence>
  </xs:complexType>

  <!--==========================================================-->
  <!--=====                 Domestic Trader                =====-->
  <!--==========================================================-->
  <xs:complexType name="DomesticTraderType">
    <xs:annotation>
      <xs:documentation>
        <doc:description value="Dane podmiotu krajowego dla nabycia wewnątrzwspólnotowego" />
      </xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="TaxNumber" type="ie:TaxNumberDomesticType"/>
      <xs:element name="TraderAddress" type="ie:TraderBranchAddressType"/>
      <xs:element name="Product" type="ie:ProductType" maxOccurs="unbounded" />
    </xs:sequence>
  </xs:complexType>

  <!--==========================================================-->
  <!--=====                 Trader Address                 =====-->
  <!--==========================================================-->
  <xs:complexType name="TraderAddressType">
    <xs:annotation>
      <xs:documentation>
        <doc:description value="Nazwa podmiotu i adres zamieszkania / siedziby firmy podmiotu" />
      </xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <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="CountryCode" type="emcs:CountryCodeType"/>
    </xs:sequence>
  </xs:complexType>

  <!--==========================================================-->
  <!--=====              Trader Branch Address             =====-->
  <!--==========================================================-->
  <xs:complexType name="TraderBranchAddressType">
    <xs:annotation>
      <xs:documentation>
        <doc:description value="Nazwa i adres miejsca zamieszkania lub siedziby podmiotu krajowego" />
      </xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <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:complexType>

  <!--==========================================================-->
  <!--=====           National Court Register Id           =====-->
  <!--==========================================================-->
  <xs:simpleType name="NationalCourtRegisterIdType">
    <xs:annotation>
      <xs:documentation>
        <doc:description value="Numer w Krajowym Rejestrze sądowym" />
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:token">
      <xs:length value="10"/>
      <xs:pattern value="[0-9]*"/>
    </xs:restriction>
  </xs:simpleType>

  <!--==========================================================-->
  <!--=====               Tax Number Foreign               =====-->
  <!--==========================================================-->
  <xs:simpleType name="TaxNumberForeignType">
    <xs:annotation>
      <xs:documentation>
        <doc:description value="Numer identyfikacji podatkowej podmiotu zagranicznego" />
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:token">
      <xs:length value="12"/>
      <xs:pattern value="[A-Z]{2}[0-9]{10}"/>
    </xs:restriction>
  </xs:simpleType>

  <!--==========================================================-->
  <!--=====            Tax Number Type Domestic            =====-->
  <!--==========================================================-->
  <xs:simpleType name="TaxNumberDomesticType">
    <xs:annotation>
      <xs:documentation>
        <doc:description xml:lang="pl" value="Numer identyfikacji podatkowej podmiotu krajowego" />
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:token">
      <xs:length value="10"/>
      <xs:pattern value="[0-9]*"/>
    </xs:restriction>
  </xs:simpleType>

</xs:schema>