<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"
  targetNamespace="http://rejestry.ezdrowie.gov.pl/rhf/eksport-danych-v1.0"
  xmlns="http://rejestry.ezdrowie.gov.pl/rhf/eksport-danych-v1.0">

    <xs:element name="Hurtownie">
        <xs:complexType>
            <xs:sequence>
                <xs:element name="Hurtownia" type="HurtowniaTYPE" maxOccurs="unbounded"
                  minOccurs="0"/>
            </xs:sequence>
            <xs:attribute name="stanNaDzien"/>
        </xs:complexType>
    </xs:element>

    <xs:complexType name="HurtowniaTYPE">
        <xs:sequence>
            <xs:element name="Adres" type="AdresTYPE" minOccurs="0"/>
            <xs:element name="ZakresDzialalnosci" type="ZakresDzialalnosciTYPE" minOccurs="0"/>
            <xs:element name="Wlasciciele" minOccurs="0">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element name="Wlasciciel" type="WlascicielTYPE" minOccurs="0" maxOccurs="unbounded"/>
                    </xs:sequence>
                </xs:complexType>
            </xs:element>
            <xs:element name="Zezwolenie" type="ZezwolenieTYPE" minOccurs="0"/>
            <xs:element name="ZmianyZezwolen" minOccurs="0">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element name="Zmiana" type="ZmianaTYPE" minOccurs="0" maxOccurs="unbounded"/>
                    </xs:sequence>
                </xs:complexType>
            </xs:element>
            <xs:element name="ZezwolenieNaPsychotropy" type="ZezwolenieNaPsychotropyTYPE" minOccurs="0"/>
            <xs:element name="LicencjaNaPrekursory" type="LicencjaNaPrekursoryTYPE" minOccurs="0"/>
            <xs:element name="ZmianyLicencjiNaPrekursory" minOccurs="0">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element name="Zmiana" type="ZmianaTYPE" minOccurs="0" maxOccurs="unbounded"/>
                    </xs:sequence>
                </xs:complexType>
            </xs:element>
            <xs:element name="KomoryPrzeladunkowe" minOccurs="0">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element name="Komora" type="KomoraTYPE" minOccurs="0" maxOccurs="unbounded"/>
                    </xs:sequence>
                </xs:complexType>
            </xs:element>
        </xs:sequence>
        <xs:attribute name="id" type="xs:long"/>
        <xs:attribute name="status" type="xs:string"/>
        <xs:attribute name="rodzaj" type="xs:string"/>
        <xs:attribute name="nazwa" type="xs:string"/>
    </xs:complexType>

    <xs:complexType name="AdresTYPE">
        <xs:sequence/>
        <xs:attribute name="ulic" type="xs:string"/>
        <xs:attribute name="terc" type="xs:string"/>
        <xs:attribute name="simc" type="xs:string"/>
        <xs:attribute name="gmina" type="xs:string"/>
        <xs:attribute name="powiat" type="xs:string"/>
        <xs:attribute name="wojewodztwo" type="xs:string"/>
        <xs:attribute name="poczta" type="xs:string"/>
        <xs:attribute name="numerLokalu" type="xs:string"/>
        <xs:attribute name="numerDomu" type="xs:string"/>
        <xs:attribute name="nazwaUlicy" type="xs:string"/>
        <xs:attribute name="rodzajUlicy" type="xs:string"/>
        <xs:attribute name="miejscowosc" type="xs:string"/>
        <xs:attribute name="kodPocztowy" type="xs:string"/>
    </xs:complexType>

    <xs:complexType name="ZakresDzialalnosciTYPE">
        <xs:sequence>
            <xs:element name="InneDzialaniaOpis" type="xs:string" minOccurs="0"/>
            <xs:element name="InneProduktyOpis" type="xs:string" minOccurs="0"/>
            <xs:element name="InneTemperaturyOpis" type="xs:string" minOccurs="0"/>
            <xs:element name="UwagiZakresuDzialalnosciLubOgraniczeniaAsortymentu" type="xs:string" minOccurs="0"/>
            <xs:element name="Zakresy" minOccurs="0">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element name="Zakres" type ="ZakresTYPE" minOccurs="0" maxOccurs="unbounded"/>
                    </xs:sequence>
                </xs:complexType>
            </xs:element>
        </xs:sequence>
    </xs:complexType>

    <xs:complexType name="ZakresTYPE">
        <xs:sequence>
            <xs:element name="Kod" type="xs:string" minOccurs="0"/>
            <xs:element name="Nazwa" type="xs:string" minOccurs="0"/>
        </xs:sequence>
        <xs:attribute name="czyPrzedKwiecien2019" type="xs:boolean" use="required"/>
        <xs:attribute name="od2026" type="xs:boolean" use="required"/>
    </xs:complexType>

    <xs:complexType name="WlascicielTYPE">
        <xs:sequence>
            <xs:element name="Adres" type="AdresTYPE" minOccurs="0"/>
        </xs:sequence>
        <xs:attribute name="nazwa" type="xs:string"/>
        <xs:attribute name="imie" type="xs:string"/>
        <xs:attribute name="nazwisko" type="xs:string"/>
        <xs:attribute name="nip" type="xs:string"/>
        <xs:attribute name="regon" type="xs:string"/>
        <xs:attribute name="krs" type="xs:string"/>
        <xs:attribute name="formaPrawna" type="xs:string"/>
    </xs:complexType>

    <xs:complexType name="WlascicieleTYPE">
        <xs:sequence>
            <xs:element name="Adres" type="AdresTYPE" minOccurs="0"/>
            <xs:element name="Wlasciciel" type="WlascicielTYPE" minOccurs="0" maxOccurs="unbounded"/>
        </xs:sequence>
        <xs:attribute name="nazwaSpolkiCywilnej" type="xs:string"/>
        <xs:attribute name="nip" type="xs:string"/>
        <xs:attribute name="regon" type="xs:string"/>
    </xs:complexType>

    <xs:complexType name="ZezwolenieTYPE">
        <xs:sequence/>
        <xs:attribute name="nrZezwolenia" type="xs:string"/>
        <xs:attribute name="sygnaturaSprawyDlaCofnieciaWygaszeniaZezwolenia" type="xs:string"/>
        <xs:attribute name="dataNadaniaRygoruNatychmiastowejWykonalnosci" type="xs:string"/>
        <xs:attribute name="dataUprawomocnieniaCofnieciaWygaszenia" type="xs:string"/>
        <xs:attribute name="dataWygaszeniaZezwolenia" type="xs:string"/>
        <xs:attribute name="dataCofnieciaZezwolenia" type="xs:string"/>
        <xs:attribute name="terminWaznosci" type="xs:string"/>
        <xs:attribute name="organWydajacy" type="xs:string"/>
        <xs:attribute name="dataUprawomocnienia" type="xs:string"/>
        <xs:attribute name="dataWydania" type="xs:string"/>
        <xs:attribute name="rodzajZezwolenia" type="xs:string"/>
        <xs:attribute name="sygnaturaSprawy" type="xs:string"/>
        <xs:attribute name="uwagiPubliczne" type="xs:string"/>
    </xs:complexType>

    <xs:complexType name="ZmianaTYPE">
        <xs:sequence/>
        <xs:attribute name="dataWydania" type="xs:string"/>
        <xs:attribute name="nrDokumentuZmianyZezwolenia" type="xs:string"/>
        <xs:attribute name="opisZmianyZezwolenia" type="xs:string"/>
    </xs:complexType>

    <xs:complexType name="ZezwolenieNaPsychotropyTYPE">
        <xs:sequence>
            <xs:element name="SrodkiOdurzajaceGrup" minOccurs="0">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element name="Grupa" type="GrupaTYPE" minOccurs="0" maxOccurs="unbounded"/>
                    </xs:sequence>
                </xs:complexType>
            </xs:element>
            <xs:element name="SrodkiPsychortopoweGrup" minOccurs="0">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element name="Grupa" type="GrupaTYPE" minOccurs="0" maxOccurs="unbounded"/>
                    </xs:sequence>
                </xs:complexType>
            </xs:element>
            <xs:element name="ZmianyZezwolenNaSrodkiPsychotropowe" minOccurs="0">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element name="Zmiana" type="ZmianaTYPE" minOccurs="0" maxOccurs="unbounded"/>
                    </xs:sequence>
                </xs:complexType>
            </xs:element>
        </xs:sequence>
        <xs:attribute name="nrZezwolenia" type="xs:string"/>
        <xs:attribute name="dataWydania" type="xs:string"/>
        <xs:attribute name="organWydajacy" type="xs:string"/>
    </xs:complexType>

    <xs:complexType name="GrupaTYPE">
        <xs:sequence/>
        <xs:attribute name="nazwa" type="xs:string"/>
    </xs:complexType>

    <xs:complexType name="LicencjaNaPrekursoryTYPE">
        <xs:sequence>
            <xs:element name="RodzajeZezwolen" minOccurs="0">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element name="Rodzaj" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
                    </xs:sequence>
                </xs:complexType>
            </xs:element>
        </xs:sequence>
        <xs:attribute name="numerLicencji" type="xs:string"/>
        <xs:attribute name="dataWydania" type="xs:string"/>
        <xs:attribute name="terminWaznosci" type="xs:string"/>
        <xs:attribute name="organWydajacy" type="xs:string"/>
    </xs:complexType>

    <xs:complexType name="KomoraTYPE">
        <xs:sequence>
            <xs:element name="Adres" type="AdresTYPE" minOccurs="0"/>
        </xs:sequence>
        <xs:attribute name="nazwa" type="xs:string"/>
    </xs:complexType>
</xs:schema>

