﻿<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns="http://refdatabase.refdata.ch/V2/Partner_out" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://refdatabase.refdata.ch/V2/Partner_out" elementFormDefault="qualified" attributeFormDefault="unqualified" version="2015-02" id="Partner_out">
  <xs:element name="PARTNER">
    <xs:annotation>
      <xs:documentation xml:lang="EN">Address information of partners</xs:documentation>
    </xs:annotation>
    <xs:complexType>
      <xs:sequence>
        <xs:element name="ITEM" minOccurs="0" maxOccurs="unbounded">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="PTYPE">
                <xs:annotation>
                  <xs:documentation xml:lang="EN">Partner Type, JUR or NAT</xs:documentation>
                </xs:annotation>
                <xs:simpleType>
                  <xs:restriction base="xs:string">
                    <xs:maxLength value="1"/>
                    <xs:enumeration value="JUR">
                      <xs:annotation>
                        <xs:documentation xml:lang="EN">JUR</xs:documentation>
                      </xs:annotation>
                    </xs:enumeration>
                    <xs:enumeration value="NAT">
                      <xs:annotation>
                        <xs:documentation xml:lang="EN">NAT</xs:documentation>
                      </xs:annotation>
                    </xs:enumeration>
                  </xs:restriction>
                </xs:simpleType>
              </xs:element>
              <xs:element name="GLN" nillable="false">
                <xs:annotation>
                  <xs:documentation xml:lang="EN">Reference number (GLN=global location number)</xs:documentation>
                </xs:annotation>
                <xs:simpleType>
                  <xs:restriction base="xs:string">
                    <xs:length value="14"/>
                  </xs:restriction>
                </xs:simpleType>
              </xs:element>
              <xs:element name="STATUS">
                <xs:annotation>
                  <xs:documentation xml:lang="EN">Status, e.g. A=active, I=inactive</xs:documentation>
                </xs:annotation>
                <xs:simpleType>
                  <xs:restriction base="xs:string">
                    <xs:maxLength value="1"/>
                    <xs:enumeration value="A">
                      <xs:annotation>
                        <xs:documentation xml:lang="EN">Active</xs:documentation>
                      </xs:annotation>
                    </xs:enumeration>
                    <xs:enumeration value="I">
                      <xs:annotation>
                        <xs:documentation xml:lang="EN">Inactive</xs:documentation>
                      </xs:annotation>
                    </xs:enumeration>
                  </xs:restriction>
                </xs:simpleType>
              </xs:element>
              <xs:element name="STDATE" type="xs:dateTime">
                <xs:annotation>
                  <xs:documentation>Date of last status change</xs:documentation>
                </xs:annotation>
              </xs:element>
              <xs:element name="LANG">
                <xs:annotation>
                  <xs:documentation xml:lang="EN">Language</xs:documentation>
                </xs:annotation>
                <xs:simpleType>
                  <xs:restriction base="xs:string">
                    <xs:maxLength value="2"/>
                  </xs:restriction>
                </xs:simpleType>
              </xs:element>
              <xs:element name="DESCR1" nillable="false">
                <xs:annotation>
                  <xs:documentation xml:lang="EN">JUR -> Name / NAT -> Lastname</xs:documentation>
                </xs:annotation>
                <xs:simpleType>
                  <xs:restriction base="xs:string">
                    <xs:maxLength value="50"/>
                  </xs:restriction>
                </xs:simpleType>
              </xs:element>
              <xs:element name="DESCR2" nillable="false" minOccurs="0">
                <xs:annotation>
                  <xs:documentation xml:lang="EN">JUR -> Additionnal Name / NAT -> Firstname</xs:documentation>
                </xs:annotation>
                <xs:simpleType>
                  <xs:restriction base="xs:string">
                    <xs:maxLength value="50"/>
                  </xs:restriction>
                </xs:simpleType>
              </xs:element>
              <xs:element name="ROLE" maxOccurs="unbounded">
                <xs:complexType>
                  <xs:sequence>
                    <xs:element name="TYPE">
                      <xs:annotation>
                        <xs:documentation>Mnemonic, e.g. Pharm=Pharmacy, Hosp=Hospital</xs:documentation>
                      </xs:annotation>
                      <xs:simpleType>
                        <xs:restriction base="xs:string">
                          <xs:maxLength value="50"/>
                        </xs:restriction>
                      </xs:simpleType>
                    </xs:element>
                    <xs:element name="STREET" nillable="false" minOccurs="0">
                      <xs:simpleType>
                        <xs:restriction base="xs:string">
                          <xs:maxLength value="50"/>
                        </xs:restriction>
                      </xs:simpleType>
                    </xs:element>
                    <xs:element name="STRNO" nillable="false" minOccurs="0">
                      <xs:annotation>
                        <xs:documentation>Street No.</xs:documentation>
                      </xs:annotation>
                      <xs:simpleType>
                        <xs:restriction base="xs:string">
                          <xs:maxLength value="50"/>
                        </xs:restriction>
                      </xs:simpleType>
                    </xs:element>
                    <xs:element name="POBOX" nillable="false" minOccurs="0">
                      <xs:annotation>
                        <xs:documentation xml:lang="EN">Post box</xs:documentation>
                      </xs:annotation>
                      <xs:simpleType>
                        <xs:restriction base="xs:string">
                          <xs:maxLength value="50"/>
                        </xs:restriction>
                      </xs:simpleType>
                    </xs:element>
                    <xs:element name="ZIP" nillable="false" minOccurs="0">
                      <xs:simpleType>
                        <xs:restriction base="xs:string">
                          <xs:maxLength value="6"/>
                        </xs:restriction>
                      </xs:simpleType>
                    </xs:element>
                    <xs:element name="CITY" nillable="false" minOccurs="0">
                      <xs:simpleType>
                        <xs:restriction base="xs:string">
                          <xs:maxLength value="50"/>
                        </xs:restriction>
                      </xs:simpleType>
                    </xs:element>
                    <xs:element name="CTN" nillable="false" minOccurs="0">
                      <xs:annotation>
                        <xs:documentation>Canton</xs:documentation>
                      </xs:annotation>
                      <xs:simpleType>
                        <xs:restriction base="xs:string">
                          <xs:maxLength value="2"/>
                        </xs:restriction>
                      </xs:simpleType>
                    </xs:element>
                    <xs:element name="CNTRY" nillable="false" minOccurs="0">
                      <xs:annotation>
                        <xs:documentation>Country</xs:documentation>
                      </xs:annotation>
                      <xs:simpleType>
                        <xs:restriction base="xs:string">
                          <xs:maxLength value="2"/>
                        </xs:restriction>
                      </xs:simpleType>
                    </xs:element>
                  </xs:sequence>
                </xs:complexType>
              </xs:element>
            </xs:sequence>
            <xs:attribute name="DT" type="xs:dateTime" use="required">
              <xs:annotation>
                <xs:documentation>Date and time of last data change</xs:documentation>
              </xs:annotation>
            </xs:attribute>
          </xs:complexType>
        </xs:element>
        <xs:element name="RESULT">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="OK_ERROR">
                <xs:simpleType>
                  <xs:restriction base="xs:string">
                    <xs:maxLength value="5"/>
                    <xs:enumeration value="OK">
                      <xs:annotation>
                        <xs:documentation xml:lang="EN">Result is OK</xs:documentation>
                      </xs:annotation>
                    </xs:enumeration>
                    <xs:enumeration value="ERROR">
                      <xs:annotation>
                        <xs:documentation xml:lang="EN">Error during data access</xs:documentation>
                      </xs:annotation>
                    </xs:enumeration>
                  </xs:restriction>
                </xs:simpleType>
              </xs:element>
              <xs:element name="NBR_RECORD" type="xs:int" minOccurs="0">
                <xs:annotation>
                  <xs:documentation xml:lang="EN">Number of records</xs:documentation>
                </xs:annotation>
              </xs:element>
              <xs:element name="ERROR_CODE" minOccurs="0">
                <xs:annotation>
                  <xs:documentation xml:lang="EN">
                    Error Code
                    1 = invalid parameter
                    2 = server error
                  </xs:documentation>
                </xs:annotation>
                <xs:simpleType>
                  <xs:restriction base="xs:string">
                    <xs:maxLength value="20"/>
                  </xs:restriction>
                </xs:simpleType>
              </xs:element>
              <xs:element name="MESSAGE" minOccurs="0">
                <xs:annotation>
                  <xs:documentation xml:lang="EN">Message</xs:documentation>
                </xs:annotation>
                <xs:simpleType>
                  <xs:restriction base="xs:string">
                    <xs:maxLength value="2000"/>
                  </xs:restriction>
                </xs:simpleType>
              </xs:element>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
      </xs:sequence>
      <xs:attribute name="CREATION_DATETIME" type="xs:dateTime" use="required">
        <xs:annotation>
          <xs:documentation>Date and time of data download</xs:documentation>
        </xs:annotation>
      </xs:attribute>
    </xs:complexType>
  </xs:element>
</xs:schema>
