﻿<?xml version="1.0"?>
<schema
	xmlns="http://www.w3.org/2001/XMLSchema"
	targetNamespace="https://www.apnf.com/pflau/messages"
	xmlns:m="https://www.apnf.com/pflau/messages"
	xmlns:a="http://www.telecom.gouv.fr/normau/address"
	xmlns:dc="http://purl.org/dc/terms"
	xmlns:gs="http://www.opengis.net/pidflo/1.0"
	xmlns:gml="http://www.opengis.net/gml"
	elementFormDefault="qualified"
>

<!-- ===========================================================================
    Import xsd
=========================================================================== -->

  <!-- Mirror locally
	<import namespace="http://www.telecom.gouv.fr/normau/address" schemaLocation="http://www.telecom.gouv.fr/normau/address.xsd"/>
	<import namespace="http://purl.org/dc/terms" schemaLocation="http://www.telecom.gouv.fr/normau/dc.xsd"/>
	<import namespace="http://www.opengis.net/gml" schemaLocation="http://www.telecom.gouv.fr/normau/Imports/geoshape/geometryBasic2d.xsd"/>
	<import namespace="http://www.opengis.net/pidflo/1.0" schemaLocation="http://www.telecom.gouv.fr/normau/Imports/geoshape/GML-pidf-lo-shape.xsd"/>
  -->
	<import namespace="http://www.telecom.gouv.fr/normau/address" schemaLocation="../www.telecom.gouv.fr/address.xsd"/>
	<import namespace="http://purl.org/dc/terms" schemaLocation="../purl.org/dc.xsd"/>
	<import namespace="http://www.opengis.net/gml" schemaLocation="../www.opengis.net/geometryPrimitives.xsd"/>
	<import namespace="http://www.opengis.net/pidflo/1.0" schemaLocation="../www.opengis.net/GML-pidf-lo-shape.xsd"/>

<!-- ===========================================================================
    Type : Operator
=========================================================================== -->

  <simpleType name="codeARCEP">
    <annotation>
      <documentation>operatorIn (code ARCEP de l’opérateur donneur, receveur ou attributaire)</documentation>
    </annotation>
    <restriction base="string">
      <maxLength value="4"/>
    </restriction>
  </simpleType>
  
	<element name="Operator">
		<annotation>
			<documentation>Un appel téléphonique</documentation>
		</annotation>
		<complexType>
			<sequence>
        <element name="operatorIn"  type="m:codeARCEP"/>
        <element name="operatorOut" type="m:codeARCEP" minOccurs="0" maxOccurs="1"/>
        <element name="operatorToContact" type="m:codeARCEP" minOccurs="0" maxOccurs="1"/>
			</sequence>
		</complexType>
	</element>
  
    <complexType name="notifyOperatorType">
			<sequence>
			   <element ref="dc:date">
					<annotation>
						<documentation>Date systeme de l'appel du webservice</documentation>
					</annotation>
				</element>
				<element name="operatorId" minOccurs="1" maxOccurs="1">
					<annotation>
						<documentation>Code ARCEP de l’opérateur receveur de la notif</documentation>
					</annotation>
					<simpleType>
						<restriction base="string">
							<maxLength value="4"/>
						</restriction>
					</simpleType>
				</element>
				<element name="SL" type="float">
					<annotation>
						<documentation>Service Level : 95%</documentation>
					</annotation>
				</element>
				<element name="MTTA" type="float">
					<annotation>
						<documentation>MTTA : Mean Time To Answer : 0.120</documentation>
					</annotation>
				</element>
				<element name="NBOK" type="float"/>
				<element name="NBKO" type="float"/>
				<element name="NBPUSH" type="float"/>
			</sequence>
		</complexType>

<!-- ===========================================================================
    Type : PhoneCall
=========================================================================== -->

	<element name="PhoneCall">
		<annotation>
			<documentation>Un appel téléphonique. Pour des raisons de performance, ce bloc a ete copie en local</documentation>
		</annotation>
		<complexType>
			<sequence>
				<element ref="dc:date">
					<annotation>
						<documentation>Horodatage de l'appel téléphonique. Si cet horodatage n'est pas disponible, il est possible de mettre l'horodatage de l'appel WS car l'écart est suffisamment réduit.</documentation>
					</annotation>
				</element>
				<element name="id" type="string">
					<annotation>
						<documentation>Ce numéro émis par chaque entité est défini au niveau NF399 par une balise nommée « nM »</documentation>
					</annotation>
				</element>
				<element name="psapPhone" type="a:Tel">
					<annotation>
						<documentation>Numéro long du PSAP</documentation>
					</annotation>
				</element>
				<element name="psapId" type="string" minOccurs="0" maxOccurs="1">
					<annotation>
						<documentation>L’identifiant d’une entité PSAP est défini au niveau NF399 par une balise nommée « NE »</documentation>
					</annotation>
				</element>
				<element ref="a:NDI"/>
				<element ref="a:NDS" minOccurs="0" maxOccurs="1"/>
			</sequence>
		</complexType>
	</element>

  <element name="Status">
    <complexType>
        <annotation>
            <documentation>Permet la remontée de l'information</documentation>
        </annotation>
        <sequence>
            <element name="code">
                <annotation>
                    <documentation>ex: WAR0001</documentation>
                </annotation>
                <simpleType>
                    <restriction base="string">
                        <maxLength value="7"/>
                    </restriction>
                </simpleType>
            </element>
            <element name="message">
                <annotation>
                    <documentation>précision éventuelle du statut remonte</documentation>
                </annotation>
                <simpleType>
                    <restriction base="string">
                        <maxLength value="255"/>
                    </restriction>
                </simpleType>
            </element>
        </sequence>
    </complexType>
  </element>

    <!-- ===========================================================================
        Type : SVH
    =========================================================================== -->

    <element name="SVH">
        <annotation>
            <documentation>Les Informations SVH supplémentaires. Pour des raisons de performance, ce bloc a ete copie en local</documentation>
        </annotation>
        <complexType>
            <sequence>
                <element name="id" type="string">
                    <annotation>
                        <documentation>id du pull fourni par les psap lors du getTerminalLocalisationSvh. Ce numéro émis par chaque entité est défini au niveau NF399 par une balise nommée « nM »</documentation>
                    </annotation>
                </element>
                <element name="source" type="string" minOccurs="0" maxOccurs="1">
                    <annotation>
                        <documentation>source de la localisation ex: CRA, Géolocalisation</documentation>
                    </annotation>
                </element>
                <element name="infComp" type="string" minOccurs="0" maxOccurs="1">
                    <annotation>
                        <documentation>Infos complémentaires ex: Numéro non localisé, Numéro Localisé en Espagne</documentation>
                    </annotation>
                </element>
                <element name="errFonc" type="string" minOccurs="0" maxOccurs="1">
                    <annotation>
                        <documentation>Message d’erreur fonctionnelle, ex:Pas sur le réseau opérateur</documentation>
                    </annotation>
                </element>
                <element ref="dc:date" minOccurs="0" maxOccurs="1">
                    <annotation>
                        <documentation>Date / Heure de la localisation</documentation>
                    </annotation>
                </element>
                <element name="profondeur" type="string" minOccurs="0" maxOccurs="1">
                    <annotation>
                        <documentation>Profondeur d’analyse réalisée (optimum)</documentation>
                    </annotation>
                </element>
                <element name="nature" type="string" minOccurs="0" maxOccurs="1">
                    <annotation>
                        <documentation>Nature de la réponse. ex Barycentre ou Antenne</documentation>
                    </annotation>
                </element>
            </sequence>
        </complexType>
    </element>

    <!-- ===========================================================================
        SOAP-Fault
    =========================================================================== -->

	<element name="UnprocessableMessageFault">
		<annotation>
			<documentation>Cette erreur métier ("Pas de réponse chez l'opérateur sollicité", "Opérateur non raccordé"...) peut contenir un détail précisant quel opérateur solliciter ensuite.</documentation>
		</annotation>
		<complexType>
			<sequence>
				<element name="detailMsg" type="string">
					<annotation>
						<documentation>precision complémentaire de la "fault"</documentation>
					</annotation>
				</element>
			</sequence>
		</complexType>
	</element>

	<element name="NotImplementedFault">
		<annotation>
			<documentation>La transaction n'est pas gérée par le service. Par exemple, on fait une requête pull à un service d'urgence ou une requête push à un opérateur téléphonique.</documentation>
		</annotation>
		<complexType>
		<all>
				<element name="errorMessage" type="string"/>
		</all>
		</complexType>
	</element>

	<element name="InvalidMessageFault">
		<annotation>
			<documentation>Le message n'est pas conforme au schéma XSD.</documentation>
		</annotation>
		<complexType>
			<all>
				<element name="errorMessage" type="string" />
			</all>
		</complexType>
	</element>

<!-- ========= -->
<!-- PULL zone -->
<!-- ========= -->

<!-- ===========================================================================
    PULL->OPERATOR: getAddress
=========================================================================== -->

	<element name="getAddressRequest">
		<complexType>
			<sequence>
				<element ref="m:PhoneCall"/>
				<element ref="m:Operator"/>
			</sequence>
		</complexType>
	</element>

	<element name="getAddressResponse">
		<complexType>
			<sequence>
				<element ref="m:PhoneCall"/>
				<element ref="m:Operator"/>
				<sequence minOccurs="1" maxOccurs="unbounded">
				  <element ref="a:UAA"/>
				</sequence>
				<element ref="m:Status" minOccurs="0">
				</element>
			</sequence>
		</complexType>
	</element>

<!-- ===========================================================================
    PULL->OPERATOR: notifyOperator
=========================================================================== -->

	<element name="notifyOperatorRequest" type="m:notifyOperatorType"/>

	<element name="notifyOperatorResponse" type="m:notifyOperatorType">
	  <annotation>
			<documentation>La réponse d'une transaction notifyOperator :  on répond l'écho de la requête pour valider la bonne réception.</documentation>
		</annotation>
	</element>

<!-- ================== -->
<!-- PULL SVH only zone -->
<!-- ================== -->

<!-- ===========================================================================
    PULL->OPERATOR:  GetLocationSVH
=========================================================================== -->

    <element name="getLocationSVHRequest">
        <complexType>
            <sequence>
                <element ref="m:PhoneCall"/>
                <element name="strictSVH" type="boolean">
                  <annotation>
                    <documentation>La réponse ne sera pas assuré par L'OCE en cas de valeur à faux</documentation>
                  </annotation>
                </element>
            </sequence>
        </complexType>
    </element>

    <element name="getLocationSVHResponse">
        <complexType>
            <sequence>
                <element ref="m:PhoneCall"/>
                <element name="strictSVH" type="boolean">
                  <annotation>
                    <documentation>La réponse ne sera pas assuré par L'OCE en cas de valeur à faux</documentation>
                  </annotation>
                </element>
                <element ref="m:Status" minOccurs="0">
                </element>
            </sequence>
        </complexType>
    </element>

<!-- ========= -->
<!-- PUSH zone -->
<!-- ========= -->

<!-- ===========================================================================
    OPERATOR->PUSH: pushLocation
=========================================================================== -->

	<element name="pushLocationRequest">
		<annotation>
			<documentation>La requête d'une transaction push : on envoit la description de l'appel et la localisation (sous forme d'arc, d'ellipse ou de polygone, ou avec les champs ARCEP).</documentation>
		</annotation>
		<complexType>
			<sequence>
				<element ref="m:PhoneCall"/>
				<choice>
					<element ref="gs:ArcBand"/>
					<element ref="gml:Polygon"/>
					<element ref="gs:Ellipse"/>
				</choice>
                <element ref="m:SVH" minOccurs="0" maxOccurs="1">
                    <annotation>
                        <documentation>Requis seulement en contexte SVH</documentation>
                    </annotation>
                </element>
			</sequence>
		</complexType>
	</element>

	<element name="pushLocationResponse">
		<annotation>
			<documentation>La réponse d'une transaction push : on répond l'écho de la requête pour valider la bonne réception.</documentation>
		</annotation>
		<complexType>
			<sequence>
				<element ref="m:PhoneCall"/>
				<choice>
					<element ref="gs:ArcBand"/>
					<element ref="gml:Polygon"/>
					<element ref="gs:Ellipse"/>
				</choice>
                <element ref="m:SVH" minOccurs="0" maxOccurs="1">
                    <annotation>
                        <documentation>Requis seulement en contexte SVH</documentation>
                    </annotation>
                </element>
			</sequence>
		</complexType>
	</element>

</schema>
