<?xml version="1.0"?>
<schema targetNamespace="http://ws.infotorg.no/xml/EVRY/InfotorgEiendom/2013-11-22/InfotorgEiendom.xsd"
    xmlns:tns="http://ws.infotorg.no/xml/EVRY/InfotorgEiendom/2013-11-22/InfotorgEiendom.xsd"
    xmlns:feil="http://ws.infotorg.no/xml/Feil/Feil.xsd"
    xmlns="http://www.w3.org/2001/XMLSchema">

    <annotation>
        <documentation xml:lang="no">
            Datatyper for InfotorgEiendom

            © 2013 EVRY AS
            Forfatter: Andreas Baaserud &lt;andreas.baaserud@evry.com&gt;
        </documentation>
    </annotation>

    <import
        namespace="http://ws.infotorg.no/xml/Feil/Feil.xsd"
        schemaLocation="https://ws.infotorg.no/xml/Feil/Feil.xsd"/>

    <element name="hentAdressekoordinater">
        <annotation>
            <documentation>Søk på matrikkel og adresse</documentation>
        </annotation>
        <complexType>
            <sequence>
                <group ref="tns:AdressekoordSoek"/>
            </sequence>
        </complexType>
    </element>

    <group name="AdressekoordSoek">
        <sequence>
            <element name="egenid" type="tns:egenid" minOccurs="0"/>
            <element name="knr" type="tns:global1" minOccurs="1"/>

             <choice>
                <sequence>
                    <element name="gatenr" type="tns:global2" minOccurs="1"/>
                    <element name="hnr" type="tns:global1" minOccurs="1"/>
                    <element name="bokstav" type="tns:bokstav" minOccurs="0"/>
                </sequence>
                <sequence>
                    <element name="gnr" type="tns:global2" minOccurs="1"/>
                    <element name="bnr" type="tns:global1" minOccurs="1"/>
                    <element name="festenr" type="tns:global1" minOccurs="0"/>
                    <element name="snr" type="tns:global1" minOccurs="0"/>
                </sequence>
            </choice>
        </sequence>
    </group>

    <element name="Adressekoordinater" type="tns:AdressekoordResultat"/>

    <complexType name="AdressekoordResultat">
        <sequence>
            <element name="status" type="string"/>
            <element name="egenid" type="string"/>
            <element name="x-koordinat-33" type="string" minOccurs="1"/>
            <element name="y-koordinat-33" type="string" minOccurs="1"/>
            <element name="x-koordinat-32" type="string" minOccurs="0"/>
            <element name="y-koordinat-32" type="string" minOccurs="0"/>
            <element name="x-koordinat-35" type="string" minOccurs="0"/>
            <element name="y-koordinat-35" type="string" minOccurs="0"/>
        </sequence>
    </complexType>
    
    <simpleType name="global1">
        <restriction base="string">
            <annotation>
                <documentation>Min lengde 1, maks lengde 4</documentation>
            </annotation>
            <minLength value="1"/>
            <maxLength value="4"/>
        </restriction>
    </simpleType>

    <simpleType name="global2">
        <restriction base="string">
            <annotation>
                <documentation>Min lengde 1, maks lengde 5</documentation>
            </annotation>
            <minLength value="1"/>
            <maxLength value="5"/>
        </restriction>
    </simpleType>

    <simpleType name="egenid">
        <restriction base="string">
            <annotation>
                <documentation>Min lengde 1, maks lengde 16</documentation>
            </annotation>
            <minLength value="1"/>
            <maxLength value="16"/>
        </restriction>
    </simpleType>

    <simpleType name="bokstav">
        <restriction base="string">
            <annotation>
                <documentation>Min lengde 1, maks lengde 1</documentation>
            </annotation>
            <minLength value="1"/>
            <maxLength value="1"/>
        </restriction>
    </simpleType>
</schema>
