<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns="urn:cz:isvs:aisv:schemas:AisvTypy:v1" 
           xmlns:xs="http://www.w3.org/2001/XMLSchema" 
           xmlns:reg="urn:cz:isvs:reg:schemas:RegTypy:v1" 
           targetNamespace="urn:cz:isvs:aisv:schemas:AisvTypy:v1" 
           elementFormDefault="qualified" 
           attributeFormDefault="unqualified" 
           version="0.9.2">
	<xs:annotation>
		<xs:documentation xml:lang="cs">XML schéma s definicemi dat pro služby AISV.</xs:documentation>
	</xs:annotation>

    <!-- Vývojová verze 0.9.0, 14.6.2023, Vladimír Hudec  Úvodní verze -->
    <!-- Vývojová verze 0.9.1, 18.7.2023, Vladimír Hudec, odstraněny procesní položky -->
    <!-- Vývojová verze 0.9.2, 26.8.2024, Vladimír Hudec, přidaná položka ZmenaCasType do aplikačního statusu -->

	<xs:import namespace="urn:cz:isvs:reg:schemas:RegTypy:v1" schemaLocation="../../RegTypy.xsd"/>
	
	<xs:complexType name="PaisIdType">
		<xs:annotation>
			<xs:documentation xml:lang="cs">Id subjektu změny. Může být AIFO nebo IČO.
            </xs:documentation>
		</xs:annotation>
		<xs:choice>
			<xs:element name="Aifo" type="reg:LokalniAifoType"/>
			<xs:element name="Ico" type="reg:IcoType"/>
		</xs:choice>
	</xs:complexType>
	<xs:simpleType name="PaisZmenaIdType">
		<xs:annotation>
			<xs:documentation xml:lang="cs">Jednoznačný identifikátor změny v PAIS.</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:NMTOKEN">
			<xs:minLength value="1"/>
			<xs:maxLength value="36"/>
		</xs:restriction>
	</xs:simpleType>
	<xs:simpleType name="ZmenaIdType">
		<xs:annotation>
			<xs:documentation xml:lang="cs">Jednoznačný identifikátor změny v AISV.</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:NMTOKEN">
			<xs:minLength value="1"/>
			<xs:maxLength value="36"/>
		</xs:restriction>
	</xs:simpleType>
    <xs:simpleType name="IdKontrolaType">
        <xs:annotation>
            <xs:documentation xml:lang="cs">Součet pro kontrolu integrity AIFO/IČO a údajů.
            </xs:documentation>
        </xs:annotation>
        <xs:restriction base="xs:base64Binary">
            <xs:length value="64" />
        </xs:restriction>
    </xs:simpleType>
    <xs:simpleType name="ZmenaCasType">
        <xs:annotation>
            <xs:documentation xml:lang="cs">Datum a čas změny fyzické osoby.</xs:documentation>
        </xs:annotation>
        <xs:restriction base="reg:CasovaZnackaType" />
    </xs:simpleType>
    <xs:simpleType name="ZmenaSpecifikaceType">
        <xs:annotation>
            <xs:documentation xml:lang="cs">Specifikace změny, seznam názvů datových položek. Bitově orientovaná hodnota.
            </xs:documentation>
        </xs:annotation>
        <xs:restriction base="xs:long" />
    </xs:simpleType>

    <xs:simpleType name="VysledekSubKodAisvType">
        <xs:annotation>
            <xs:documentation xml:lang="cs">Detailní kód výsledku, výčtový typ.</xs:documentation>
        </xs:annotation>
        <xs:restriction base="xs:string">
            <xs:enumeration value="CHYBA MAPA ADRES">
                <xs:annotation>
                    <xs:documentation xml:lang="cs">
                        Neshoda mezi použitými kódy RUIAN v datové části a mapě nebo mapa chybí.
                    </xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="CHYBA MAPA AIFO">
                <xs:annotation>
                    <xs:documentation xml:lang="cs">
                        Neshoda mezi použitými AIFO v datové části a mapě nebo mapa chybí.
                    </xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="CHYBA ROZSAHU">
                <xs:annotation>
                    <xs:documentation xml:lang="cs">
                        Údaj na vstupu nevyhovuje povolené délce.
                    </xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="CHYBA TYPU">
                <xs:annotation>
                    <xs:documentation xml:lang="cs">
                        Chybný datový typ údaje vstupu.
                    </xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="NEVALIDNI DATA">
                <xs:annotation>
                    <xs:documentation xml:lang="cs">
                        Aplikační data nejsou validní podle aplikačních omezení.
                    </xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="NEVALIDNI ZADOST">
                <xs:annotation>
                    <xs:documentation xml:lang="cs">
                        Kód služby neodpovídá XML struktuře žádosti.
                    </xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="OBECNA CHYBA SLUZBY">
                <xs:annotation>
                    <xs:documentation xml:lang="cs">
                        Službu nebylo možné provést z důvodu chyby na straně poskytovatele služby
                        (chyba databázového nebo aplikačního serveru, ...).
                    </xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="PREKROCEN POCET">
                <xs:annotation>
                    <xs:documentation xml:lang="cs">
                        Překročen počet povolených záznamů. Je nutno upřesnit podmínky pro vyhledání.
                    </xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="NEPOVOLENA KOMBINACE">
                <xs:annotation>
                    <xs:documentation xml:lang="cs">
                        Vyhledávací dotaz neobsahuje žádnou z minimálních povolených
                        kombinací parametrů dotazu
                    </xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="NEPOVOLENY PARAMETR">
                <xs:annotation>
                    <xs:documentation xml:lang="cs">
                        Vyhledávací dotaz obsahuje nepovolený parametr datazu.
                    </xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="ZAZNAM NENALEZEN">
                <xs:annotation>
                    <xs:documentation xml:lang="cs">
                        stupní kombinaci údajů neodpovídá žádný záznam.
                    </xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="NENI OPRAVNENI">
                <xs:annotation>
                    <xs:documentation xml:lang="cs">
                        Není oprávnění k požadované interní službě, rozhodnutí
                        základního registru.
                    </xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="NENI K DISPOZICI">
                <xs:annotation>
                    <xs:documentation xml:lang="cs">
                        Služba není dočasně k dispozici.
                    </xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="NENI IMPLEMENTOVANO">
                <xs:annotation>
                    <xs:documentation xml:lang="cs">
                        Služba není implementována.
                    </xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="PARCIALNI ZAZNAM NEOVEREN">
                <xs:annotation>
                    <xs:documentation xml:lang="cs">
                        Pokud alespoň jeden údaj není ověřen
                    </xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="PARCIALNI ZAZNAM NENALEZEN">
                <xs:annotation>
                    <xs:documentation xml:lang="cs">
                        Pokud alespoň jedna osoba není nalezena
                    </xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="PAIS NENALEZEN">
                <xs:annotation>
                    <xs:documentation xml:lang="cs">
                        Nevalidní PAIS podle kódu agendu a AIS 
                    </xs:documentation>
                </xs:annotation>
            </xs:enumeration>
            <xs:enumeration value="UDAJ NENALEZEN">
                <xs:annotation>
                    <xs:documentation xml:lang="cs">
                        Nevalidní údaj v seznamu údajů, není v číselníku RPP 
                    </xs:documentation>
                </xs:annotation>
            </xs:enumeration>
        </xs:restriction>
    </xs:simpleType>
    <xs:complexType name="AisvAplikacniStatusType">
        <xs:annotation>
            <xs:documentation xml:lang="cs">
                Aplikační chyba, doplnění k StatusType ze systémové části zprávy, odpověď.
            </xs:documentation>
        </xs:annotation>
        <xs:sequence>
            <xs:element name="VysledekAisvKodType" type="reg:VysledekKodType" />
            <xs:element name="VysledekDetail" minOccurs="0" maxOccurs="unbounded">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element name="VysledekSubKod" type="VysledekSubKodAisvType" />
                        <xs:element name="VysledekPopis" type="reg:VysledekPopisType" minOccurs="0" />
                    </xs:sequence>
                </xs:complexType>
            </xs:element>
            <xs:element name="PosledniZmenaCas" type="ZmenaCasType" minOccurs="0" />
        </xs:sequence>
    </xs:complexType>

    <xs:simpleType name="IdTypType">
        <xs:annotation>
            <xs:documentation xml:lang="cs">Typ identifikátoru, výčtový typ, AIFO nebo IČO.</xs:documentation>
        </xs:annotation>
        <xs:restriction base="xs:string">
            <xs:enumeration value="AIFO"/>
            <xs:enumeration value="ICO"/>
        </xs:restriction>
    </xs:simpleType>
</xs:schema>
