<?xml version="1.0" encoding="utf-8"?>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">

  <xs:include schemaLocation="classifier_types.xsd"/>
  <xs:include schemaLocation="simple_types.xsd"/>

	<xs:element name="IRP_LIST">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref = "ZGLV"/>
        <xs:element ref = "IRP" minOccurs="1" maxOccurs="unbounded" />
      </xs:sequence>
    </xs:complexType>
	</xs:element>

	<xs:element name="ZGLV">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="VERSION" type="string5max"/>
        <xs:element name="DATA" type="xs:date"/>
        <xs:element name="YEAR" type="year"/>
        <xs:element name="MONTH" type="month"/>
        <xs:element name="DAY" type="day"/>
        <xs:element name="TIME" type="string7max"  minOccurs="0"/>
        <xs:element name="SMO" type="string5max"/>
        <xs:element name="FILENAME" type="string26max"/>
      </xs:sequence>
    </xs:complexType>
	</xs:element>
	
  <xs:simpleType name="IRP_TYPE_CURR">
    <xs:restriction base="xs:unsignedInt">
      <xs:minInclusive value="1" />
      <xs:maxInclusive value="5" />
    </xs:restriction>
  </xs:simpleType>

	<xs:simpleType name="ADD_B_CURR">
		<xs:restriction base="xs:unsignedInt">
			<xs:minInclusive value="1" />
			<xs:maxInclusive value="2" />
		</xs:restriction>
	</xs:simpleType>

	<xs:simpleType name="WAY_CURR">
		<xs:restriction base="xs:unsignedInt">
			<xs:minInclusive value="1" />
			<xs:maxInclusive value="6" />
		</xs:restriction>
	</xs:simpleType>

  <xs:element name="IRP">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="TF_ID" type="string36max"/>
        <xs:element name="N_IRP" type="string36max"/>
        <xs:element name="DATE_CREATE" type="xs:date"/>
        <xs:element name="TIME_CREATE" type="string5max" minOccurs="0"/>
        <xs:element name="IRP_TYPE" type="IRP_TYPE_CURR"/>
        <xs:element name="HOW" type="HOW"/>
        <xs:element name="D_WR" type="xs:dateTime" minOccurs="0"/>
        <xs:element name="ADD_B" type="ADD_B_CURR" minOccurs="0"/>
        <xs:element name="WAY" type="WAY_CURR"/>
        <xs:element name="WAY_N" type="string6max" minOccurs="0"/>
        <xs:element name="THEME" type="string7max"/>
        <xs:element name="C_ORG" type="string6max" minOccurs="0"/>
        <xs:element name="COVID" type="uint1" minOccurs="0"/>
        <xs:element name="COVID_V" type="uint1" minOccurs="0"/>
        <xs:element name="TEXT" type="string1000max" minOccurs="0"/>
        <xs:element ref="ZH" minOccurs="0"/>
        <xs:element name="PR_OUT" type="uint1" minOccurs="0"/>
        <xs:element name="DATE_CROSS" type="xs:date" minOccurs="0"/>
        <xs:element name="TIME_CROSS" type="string5max" minOccurs="0"/>
        <xs:element name="OTV_T" type="uint1"/>
        <xs:element name="OTV_KON" type="string8max"/>
        <xs:element name="LINE_1" type="uint1"/>
        <xs:element name="EMPLOYEE_1" type="string36max"/>
        <xs:element name="LINE_2" type="uint1" minOccurs="0"/>
        <xs:element name="EMPLOYEE_IT" type="string36max" minOccurs="0"/>
        <xs:element name="DATA_PLAN" type="xs:date"/>
        <xs:element name="DATE_CLOSE" type="xs:date" minOccurs="0"/>
        <xs:element name="RESULT" type="uint1" minOccurs="0"/>
        <xs:element name="RESULT_T" type="string4000max" minOccurs="0"/>
        <xs:element name="STATUS" type="uint1"/>
        <xs:element ref="Z_SV" minOccurs="0"/>
        <xs:element ref="IN_SV" minOccurs="0"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>

  <!-- ZH: block for complaint brief info and full complaint info -->
  <xs:element name="ZH">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="ZH_D" type="string3max" minOccurs="0"/>
        <xs:element name="ZH_IN" type="uint1" minOccurs="0"/>
        <xs:element name="SOL" type="uint1" minOccurs="0"/>
        <xs:element name="DATE_RETURN" type="xs:date" minOccurs="0"/>
        <xs:element name="SUM_RETURN" type="string15max" minOccurs="0"/>
        <xs:element name="ORG_RETURN" type="string6max" minOccurs="0"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>

  <!-- Z_SV: applicant information -->
  <xs:element name="Z_SV">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="Z_F" type="string40max" minOccurs="0"/>
        <xs:element name="Z_I" type="string40max" minOccurs="0"/>
        <xs:element name="Z_O" type="string40max" minOccurs="0"/>
        <xs:element name="Z_DR" type="xs:date" minOccurs="0"/>
        <xs:element name="Z_ENP" type="string16max" minOccurs="0"/>
        <xs:element name="Z_SMO" type="string5max" minOccurs="0"/>
        <xs:element name="Z_DOCTYPE" type="string2max" minOccurs="0"/>
        <xs:element name="Z_DOCSER" type="string10max" minOccurs="0"/>
        <xs:element name="Z_DOCNUM" type="string20max" minOccurs="0"/>
        <xs:element name="ADR" type="string120max" minOccurs="0"/>
        <xs:element name="PHONE" type="string20max" minOccurs="0"/>
        <xs:element name="E-MAIL" type="string40max" minOccurs="0"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>

  <!-- IN_SV: information about person the appeal is about -->
  <xs:element name="IN_SV">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="IN_F" type="string40max" minOccurs="0"/>
        <xs:element name="IN_I" type="string40max" minOccurs="0"/>
        <xs:element name="IN_O" type="string40max" minOccurs="0"/>
        <xs:element name="IN_DR" type="xs:date" minOccurs="0"/>
        <xs:element name="IN_ENP" type="string16max" minOccurs="0"/>
        <xs:element name="IN_SMO" type="string5max" minOccurs="0"/>
        <xs:element name="IN_DOCTYPE" type="string2max" minOccurs="0"/>
        <xs:element name="IN_DOCSER" type="string10max" minOccurs="0"/>
        <xs:element name="IN_DOCNUM" type="string20max" minOccurs="0"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>






