<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns="http://ivis.eps.gov.lv/XMLSchemas/100010/PopulationRegister/v1-0" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:pr="http://ivis.eps.gov.lv/XMLSchemas/100010/PopulationRegister/v1-0" xmlns:pers="http://ivis.eps.gov.lv/XMLSchemas/100001/Person/v1-0" xmlns:epcs="http://ivis.eps.gov.lv/XMLSchemas/100002/EPCommonSchemas/v1-0" xmlns:ivis="http://ivis.eps.gov.lv/XMLSchemas/100001/IVIS/v1-0" targetNamespace="http://ivis.eps.gov.lv/XMLSchemas/100010/PopulationRegister/v1-0" elementFormDefault="qualified" attributeFormDefault="unqualified" version="1.0" id="LegalRepresentation.xsd">
    <xs:annotation>
        <xs:appinfo>
            <ivis:Metadata xmlns:pers="http://ivis.eps.gov.lv/XMLSchemas/100001/Person/v1-0" xmlns:ivis="http://ivis.eps.gov.lv/XMLSchemas/100001/IVIS/v1-0">
                <ivis:Contributor Href="http://www.rixtechnologies.lv" CodeListID="Authority" CodeListAgencyID="100001" CodeListAgencyName="VRAA" CodeListLanguageID="lv" CodeListCodeValue="100002">A/S "RIX Technologies"</ivis:Contributor>
                <ivis:Creator CodeListID="Authority" CodeListAgencyID="100001" CodeListAgencyName="VRAA" CodeListLanguageID="lv" CodeListCodeValue="100010">Pilsonības un migrācijas lietu pārvalde</ivis:Creator>
                <ivis:Date>
                    <ivis:Created>2012-08-14</ivis:Created>
                    <ivis:Modified>2012-08-14</ivis:Modified>
                </ivis:Date>
                <ivis:Description>
                    <ivis:Default>Shēma satur elementus, kas raksturo personas likumīgo pārstāvību pret citu personu.</ivis:Default>
                </ivis:Description>
                <ivis:Format>
                    <ivis:Default>text/xml</ivis:Default>
                </ivis:Format>
                <ivis:Identifier Scheme="URN">URN:IVIS:100001:XSD-PopulationRegister-LegalRepresentation-v1-0</ivis:Identifier>
                <ivis:Language>LV</ivis:Language>
                <ivis:Relation>
                    <ivis:ConformsTo Href="URN:IVIS:100001:DOC-FR-XML-V1.00">XML shēmu izstrādes vadlīnijas</ivis:ConformsTo>
                </ivis:Relation>
                <ivis:Status>
                    <ivis:Default>EDITED</ivis:Default>
                    <ivis:Version>v1.0</ivis:Version>
                </ivis:Status>
                <ivis:Subject>
                    <ivis:Category CodeListID="XMLSchemaType" CodeListAgencyID="100001" CodeListAgencyName="VRAA" CodeListLanguageID="lv" CodeListCodeValue="8">Lietojumu XML shēma</ivis:Category>
                    <ivis:Project>PopulationRegister</ivis:Project>
                </ivis:Subject>
                <ivis:Title>
                    <ivis:Default>Likumīgā pārstāvība</ivis:Default>
                </ivis:Title>
            </ivis:Metadata>
        </xs:appinfo>
    </xs:annotation>
    <xs:import namespace="http://ivis.eps.gov.lv/XMLSchemas/100001/IVIS/v1-0" schemaLocation="http://ivis.eps.gov.lv/XMLSchemas/100001/IVIS/v1-0/IVISResponse.xsd" />
    <xs:import namespace="http://ivis.eps.gov.lv/XMLSchemas/100001/Person/v1-0" schemaLocation="http://ivis.eps.gov.lv/XMLSchemas/100001/Person/v1-0/Person.xsd" />
    <xs:import namespace="http://ivis.eps.gov.lv/XMLSchemas/100002/EPCommonSchemas/v1-0" schemaLocation="http://ivis.eps.gov.lv/XMLSchemas/100002/EPCommonSchemas/v1-0/EServiceInstance.xsd" />
    <xs:include schemaLocation="CMISARI.xsd" />
    <xs:include schemaLocation="PersonStatus.xsd" />
    <xs:element name="LegalRepresentation" type="LegalRepresentationStructure" />
    <xs:simpleType name="LegalRepresentationKindType">
        <xs:annotation>
            <xs:documentation xml:lang="lv">Pārstāvības veida tips (B-aizbildnis, G-aizgādnis, V-vecāks)</xs:documentation>
        </xs:annotation>
        <xs:restriction base="xs:normalizedString">
            <xs:pattern value="B" />
            <xs:pattern value="G" />
            <xs:pattern value="V" />
        </xs:restriction>
    </xs:simpleType>
    <xs:complexType name="LegalRepresentationStructure">
        <xs:annotation>
            <xs:documentation xml:lang="lv">Pārstāvības struktūra</xs:documentation>
        </xs:annotation>
        <xs:sequence>
            <xs:element name="RepresentativePersonCode" type="pers:PersonCodeType">
                <xs:annotation>
                    <xs:documentation xml:lang="lv">Pārstāvja personas kods</xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element name="RepresentedPersonCode" type="pers:PersonCodeType">
                <xs:annotation>
                    <xs:documentation xml:lang="lv">Pārstāvētā personas kods</xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element name="RepresentationKind" type="LegalRepresentationKindType">
                <xs:annotation>
                    <xs:documentation xml:lang="lv">Pārstāvības veids</xs:documentation>
                </xs:annotation>
            </xs:element>
        </xs:sequence>
    </xs:complexType>
    <!--Vecāku pārstāvniecībai tiek izmantots bērnu saraksts-->
    <xs:element name="RelatedPeople" type="RelatedPeopleStructure">
        <xs:annotation>
            <xs:documentation xml:lang="lv">Saistīto personu saraksts</xs:documentation>
        </xs:annotation>
    </xs:element>
    <xs:complexType name="RelatedPersonStructure">
        <xs:annotation>
            <xs:documentation xml:lang="lv">Saistītās personas struktūra</xs:documentation>
        </xs:annotation>
        <xs:sequence>
            <xs:element name="PersonStatus" type="PersonStatusType">
                <xs:annotation>
                    <xs:documentation xml:lang="lv">Saistītās personas status</xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element name="PersonCode" type="pers:PersonCodeType">
                <xs:annotation>
                    <xs:documentation xml:lang="lv">Saistītās personas kods</xs:documentation>
                </xs:annotation>
            </xs:element>
        </xs:sequence>
    </xs:complexType>
    <xs:complexType name="RelatedPeopleStructure">
        <xs:annotation>
            <xs:documentation xml:lang="lv">Saistīto personu struktūra</xs:documentation>
        </xs:annotation>
        <xs:sequence>
            <xs:element name="SessionId" type="CMISARISessionIdType" minOccurs="0">
                <xs:annotation>
                    <xs:documentation xml:lang="lv">Sesijas identifikators</xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:choice>
                <xs:sequence maxOccurs="unbounded">
                    <xs:element name="RelatedPerson" type="RelatedPersonStructure" />
                </xs:sequence>
                <xs:element name="Error" type="ivis:ErrorStructure">
                    <xs:annotation>
                        <xs:documentation xml:lang="lv">Kļūda</xs:documentation>
                    </xs:annotation>
                </xs:element>
            </xs:choice>
        </xs:sequence>
    </xs:complexType>
    <!--Aizbildniecības un aizgādniecības pārbaudei tiek izmantots-->
    <xs:element name="Wardship" type="WardshipStructure">
        <xs:annotation>
            <xs:documentation xml:lang="lv">Pārbaudāmā pārstāvība</xs:documentation>
        </xs:annotation>
    </xs:element>
    <xs:complexType name="WardshipStructure">
        <xs:annotation>
            <xs:documentation xml:lang="lv">Pārbaudāmās pārstāvības struktūra</xs:documentation>
        </xs:annotation>
        <xs:sequence>
            <xs:element name="SessionId" type="CMISARISessionIdType" minOccurs="0">
                <xs:annotation>
                    <xs:documentation xml:lang="lv">Pieprasījuma sesijas identifikators</xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element name="GuardianPersonCode" type="pers:PersonCodeType">
                <xs:annotation>
                    <xs:documentation xml:lang="lv">Pārstāvja personas kods</xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element name="WardPersonCode" type="pers:PersonCodeType">
                <xs:annotation>
                    <xs:documentation xml:lang="lv">Pārstāvētā personas kods</xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element name="EServiceInstance" type="epcs:EServiceInstanceStructure">
                <xs:annotation>
                    <xs:documentation xml:lang="lv">ePakalpojums</xs:documentation>
                </xs:annotation>
            </xs:element>
        </xs:sequence>
    </xs:complexType>
    <xs:element name="WardshipStatus" type="WardshipStatusStructure">
        <xs:annotation>
            <xs:documentation xml:lang="lv">Pārstāvības statuss</xs:documentation>
        </xs:annotation>
    </xs:element>
    <xs:complexType name="WardshipStatusStructure">
        <xs:annotation>
            <xs:documentation xml:lang="lv">Pārstāvības statusa struktūra</xs:documentation>
        </xs:annotation>
        <xs:sequence>
            <xs:element name="SessionId" type="CMISARISessionIdType" minOccurs="0">
                <xs:annotation>
                    <xs:documentation xml:lang="lv">Sesijas identifikators</xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:choice>
                <xs:element name="Status" type="WardshipStatusType">
                    <xs:annotation>
                        <xs:documentation xml:lang="lv">Pārstāvības statuss</xs:documentation>
                    </xs:annotation>
                </xs:element>
                <xs:element name="Error" type="ivis:ErrorStructure">
                    <xs:annotation>
                        <xs:documentation xml:lang="lv">Kļūda</xs:documentation>
                    </xs:annotation>
                </xs:element>
            </xs:choice>
        </xs:sequence>
    </xs:complexType>
    <xs:simpleType name="WardshipStatusType">
        <xs:annotation>
            <xs:documentation xml:lang="lv">Pārstāvības statusa tips</xs:documentation>
        </xs:annotation>
        <xs:restriction base="xs:normalizedString">
            <xs:enumeration value="isDependant" />
            <xs:enumeration value="notUnderageWard" />
            <xs:enumeration value="notAdultWard" />
        </xs:restriction>
    </xs:simpleType>
</xs:schema>