<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
	<!--
/**
  * RC BROKER ATSAKYMO XSD failas
  * @author D.Gužauskas, dalgu@registrucentras.lt
  * @version 2022-08-16
  */
-->
	<xs:element name="buildings">
		<xs:annotation>
			<xs:documentation>Pasikeitusių NTR objektų sąrašas TIIIS</xs:documentation>
		</xs:annotation>
		<xs:complexType mixed="true">
			<xs:choice maxOccurs="unbounded">
				<xs:element name="message_id" minOccurs="1" maxOccurs="1">
					<xs:annotation>
						<xs:documentation>Gavėjo sistemoje užklausai suteiktas unikalus numeris</xs:documentation>
					</xs:annotation>
					<xs:simpleType>
						<xs:restriction base="xs:string">
							<xs:minLength value="1"/>
							<xs:maxLength value="20"/>
						</xs:restriction>
					</xs:simpleType>
				</xs:element>
				<xs:element name="message_time" type="lt_date-time" minOccurs="1" maxOccurs="1">
					<xs:annotation>
						<xs:documentation>Užklausos gavimo data ir laikas</xs:documentation>
					</xs:annotation>
				</xs:element>
				<xs:choice>
					<xs:element ref="building" minOccurs="1" maxOccurs="unbounded"/>
					<xs:element ref="info" minOccurs="1" maxOccurs="1"/>
				</xs:choice>
			</xs:choice>
		</xs:complexType>
	</xs:element>
	<xs:element name="info">
		<xs:annotation>
			<xs:documentation>Užklausos apdorojimo informacija</xs:documentation>
		</xs:annotation>
		<xs:complexType mixed="true">
			<xs:attribute name="change_date" type="lt_date" use="required">
				<xs:annotation>
					<xs:documentation>Data, už kurią buvo prašoma duomenų</xs:documentation>
				</xs:annotation>
			</xs:attribute>
			<xs:attribute name="total_buildings" type="xs:nonNegativeInteger" use="required">
				<xs:annotation>
					<xs:documentation>Rastų statinių skaičius. Formatas: "%d"</xs:documentation>
				</xs:annotation>
			</xs:attribute>
		</xs:complexType>
	</xs:element>
	<xs:element name="building">
		<xs:annotation>
			<xs:documentation>Statinio duomenų sąrašas</xs:documentation>
		</xs:annotation>
		<xs:complexType mixed="true">
			<xs:choice maxOccurs="unbounded">
				<xs:element name="building_change_type" minOccurs="1" maxOccurs="1">
					<xs:annotation>
						<xs:documentation>
							Statinio pokyčio požymis:
							ND-naujas daiktas,
							PR-pasikeitimas po rekonstrukcijos,
							PN-pasikeitimas po nugriovimo,
							PS-pasikeitimas po sujungimo,
							PD-pasikeitimas po padalijimo
						</xs:documentation>
					</xs:annotation>
					<xs:simpleType>
						<xs:restriction base="xs:string">
							<xs:enumeration value="ND"/>
							<xs:enumeration value="PR"/>
							<xs:enumeration value="PN"/>
							<xs:enumeration value="PS"/>
							<xs:enumeration value="PD"/>
						</xs:restriction>
					</xs:simpleType>
				</xs:element>
				<xs:element name="building_unique_number" minOccurs="1" maxOccurs="1">
					<xs:annotation>
						<xs:documentation>Statinio skaitinis unikalus numeris</xs:documentation>
					</xs:annotation>
					<xs:simpleType>
						<xs:restriction base="xs:positiveInteger">
							<xs:totalDigits value="16"/>
						</xs:restriction>
					</xs:simpleType>
				</xs:element>
				<xs:element name="municipality_number" type="xs:positiveInteger" minOccurs="1" maxOccurs="1">
					<xs:annotation>
						<xs:documentation>Savivaldybės unikalus numeris</xs:documentation>
					</xs:annotation>
				</xs:element>
				<xs:element name="registration_date" type="lt_date" minOccurs="1" maxOccurs="1">
					<xs:annotation>
						<xs:documentation>Įregistravimo NTR data</xs:documentation>
					</xs:annotation>
				</xs:element>
				<xs:element name="label_point_x" nillable="true" maxOccurs="1">
					<xs:annotation>
						<xs:documentation>Statinio žymės taško (label point) koordinatė X</xs:documentation>
					</xs:annotation>
					<xs:simpleType>
						<xs:union memberTypes="label_point empty-string"/>
					</xs:simpleType>
				</xs:element>
				<xs:element name="label_point_y" nillable="true" maxOccurs="1">
					<xs:annotation>
						<xs:documentation>Statinio žymės taško (label point) koordinatė Y</xs:documentation>
					</xs:annotation>
					<xs:simpleType>
						<xs:union memberTypes="label_point empty-string"/>
					</xs:simpleType>
				</xs:element>
				<xs:element name="sld_number" nillable="true" maxOccurs="1">
					<xs:annotation>
						<xs:documentation>Statybą leidžiančio dokumento (jeigu jis buvo išduotas) numeris</xs:documentation>
					</xs:annotation>
					<xs:simpleType>
						<xs:union memberTypes="doc_no empty-string"/>
					</xs:simpleType>
				</xs:element>
				<xs:element name="sld_date" nillable="true" maxOccurs="1">
					<xs:annotation>
						<xs:documentation>Statybą leidžiančio dokumento (jeigu jis buvo išduotas) data</xs:documentation>
					</xs:annotation>
					<xs:simpleType>
						<xs:union memberTypes="lt_date empty-string"/>
					</xs:simpleType>
				</xs:element>
				<xs:element name="sld_type_code" nillable="true" maxOccurs="1">
					<xs:annotation>
						<xs:documentation>Statybą leidžiančio dokumento (jeigu jis buvo išduotas) tipo klasifikatoriaus kodo reikšmė</xs:documentation>
					</xs:annotation>
					<xs:simpleType>
						<xs:union memberTypes="type_code empty-string"/>
					</xs:simpleType>
				</xs:element>
				<xs:element name="sld_type_name" nillable="true" maxOccurs="1">
					<xs:annotation>
						<xs:documentation>Statybą leidžiančio dokumento (jeigu jis buvo išduotas) aprašymas</xs:documentation>
					</xs:annotation>
					<xs:simpleType>
						<xs:union memberTypes="type_name empty-string"/>
					</xs:simpleType>
				</xs:element>
				<xs:element ref="owners" maxOccurs="1"/>
			</xs:choice>
			<xs:attribute name="change_unique_number" type="xs:long" use="required">
				<xs:annotation>
					<xs:documentation>Pranešimo įrašo (pokyčio) unikalus numeris</xs:documentation>
				</xs:annotation>
			</xs:attribute>
			<xs:attribute name="total_drawings" type="xs:nonNegativeInteger" use="required">
				<xs:annotation>
					<xs:documentation>Rastų statinio brėžinių skaičius. Formatas: "%d"</xs:documentation>
				</xs:annotation>
			</xs:attribute>
		</xs:complexType>
	</xs:element>
	<xs:element name="owners" nillable="true">
		<xs:annotation>
			<xs:documentation>Statinio savininkų (LR juridinių asmenų) sąrašas</xs:documentation>
		</xs:annotation>
		<xs:complexType>
			<xs:choice maxOccurs="unbounded">
				<xs:element ref="owner" maxOccurs="unbounded"/>
			</xs:choice>
		</xs:complexType>
	</xs:element>
	<xs:element name="owner">
		<xs:annotation>
			<xs:documentation>Statinio savininko (LR juridinio asmens) duomenys</xs:documentation>
		</xs:annotation>
		<xs:complexType>
			<xs:choice maxOccurs="unbounded">
				<xs:element name="rle_code" nillable="true" maxOccurs="1">
					<xs:annotation>
						<xs:documentation>Įmonės kodas</xs:documentation>
					</xs:annotation>
					<xs:simpleType>
						<xs:union memberTypes="rle_code-type empty-string"/>
					</xs:simpleType>
				</xs:element>
				<xs:element name="rle_name" minOccurs="1" maxOccurs="1">
					<xs:annotation>
						<xs:documentation>Įmonės pavadinimas</xs:documentation>
					</xs:annotation>
					<xs:simpleType>
						<xs:restriction base="xs:string">
							<xs:minLength value="1"/>
							<xs:maxLength value="200"/>
						</xs:restriction>
					</xs:simpleType>
				</xs:element>
			</xs:choice>
			<xs:attribute name="line_no" type="xs:byte" use="required"/>
		</xs:complexType>
	</xs:element>
	<xs:simpleType name="label_point">
		<xs:annotation>
			<xs:documentation>Tipas koordinatėms</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:decimal">
			<xs:totalDigits value="10"/>
			<xs:fractionDigits value="2"/>
		</xs:restriction>
	</xs:simpleType>
	<xs:simpleType name="doc_no">
		<xs:annotation>
			<xs:documentation>Tipas dokumento numeriui</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:string">
			<xs:minLength value="1"/>
			<xs:maxLength value="40"/>
		</xs:restriction>
	</xs:simpleType>
	<xs:simpleType name="lt_date-time">
		<xs:annotation>
			<xs:documentation>Tipas datai su laiku</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:dateTime">
			<xs:pattern value="\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}"/>
		</xs:restriction>
	</xs:simpleType>
	<xs:simpleType name="lt_date">
		<xs:annotation>
			<xs:documentation>Tipas datai</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:date">
			<xs:pattern value="\d{4}-\d{2}-\d{2}"/>
		</xs:restriction>
	</xs:simpleType>
	<xs:simpleType name="type_code">
		<xs:annotation>
			<xs:documentation>Tipas teisės potipiui</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:positiveInteger">
			<xs:totalDigits value="3"/>
		</xs:restriction>
	</xs:simpleType>
	<xs:simpleType name="type_name">
		<xs:annotation>
			<xs:documentation>Tipas teisės aprašymui</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:string">
			<xs:minLength value="1"/>
			<xs:maxLength value="2000"/>
		</xs:restriction>
	</xs:simpleType>
	<xs:simpleType name="rle_code-type">
		<xs:annotation>
			<xs:documentation>Tipas įmonės kodui</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:positiveInteger">
			<xs:totalDigits value="9"/>
		</xs:restriction>
	</xs:simpleType>
	<xs:simpleType name="empty-string">
		<xs:annotation>
			<xs:documentation>Tipas tuščiai eilutei</xs:documentation>
		</xs:annotation>
		<xs:restriction base="xs:string">
			<xs:enumeration value=""/>
		</xs:restriction>
	</xs:simpleType>
</xs:schema>
