<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:fews="http://www.wldelft.nl/fews" targetNamespace="http://www.wldelft.nl/fews" elementFormDefault="qualified" attributeFormDefault="unqualified" version="1.0">
	<include schemaLocation="sharedTypes.xsd"/>
	<element name="webServices" type="fews:WebServicesComplexType"/>
	<complexType name="WebServicesComplexType">
		<sequence>
			<element name="general" type="fews:WebServicesGeneralComplexType" minOccurs="0">
				<annotation>
					<documentation>Configurations that apply to all Web Services.</documentation>
				</annotation>
			</element>
			<element name="piRestService" type="fews:PiRestServiceComplexType" minOccurs="0">
				<annotation>
					<documentation>Configurations that apply to the PI REST Service.
					</documentation>
				</annotation>
			</element>
			<element name="wmsService" type="fews:WmsServiceComplexType" minOccurs="0">
				<annotation>
					<documentation>Configurations that apply to the Web Mapping Service (WMS).
					</documentation>
				</annotation>
			</element>
			<element name="wfsService" type="fews:WfsServiceComplexType" minOccurs="0">
				<annotation>
					<documentation>Configurations that apply to the Web Feature Service (WFS).
					</documentation>
				</annotation>
			</element>
			<element name="ssdService" type="fews:SsdServiceComplexType" minOccurs="0">
				<annotation>
					<documentation>Configurations that apply to the Schematic Status Display Service.
					</documentation>
				</annotation>
			</element>
			<element name="waterMlService" type="fews:WaterMlComplexType" minOccurs="0">
				<annotation>
					<documentation>Configurations that apply to the Water ML Service.
					</documentation>
				</annotation>
			</element>
			<element name="digitalDeltaService" type="fews:DigitalDeltaServiceComplexType" minOccurs="0">
				<annotation>
					<documentation>Configurations that apply to the Digital Delta Service
					</documentation>
				</annotation>
			</element>
			<element name="operatingRequestService" type="fews:OperatingRequestServiceComplexType" minOccurs="0">
				<annotation>
					<documentation>Configurations that apply to the Operating Request Service
					</documentation>
				</annotation>
			</element>
			<element name="webOperatorClientConfiguration" type="fews:WebOperatorClientConfigurationComplexType" minOccurs="0">
				<annotation>
					<documentation>Configure a custom Web Operator Client Configuration. If not configured, the default webOperatorClient.xml is assumed.</documentation>
				</annotation>
			</element>
		</sequence>
	</complexType>
	<complexType name="WebServicesGeneralComplexType">
		<sequence>
			<element name="filters" type="fews:FilterIdListComplexType" minOccurs="0">
				<annotation>
					<documentation>Only the timeseries defined under the configured filter id will be visible to the FewsPiService. If this option is omitted then it is necessary to define a defaultFilterId in the filters configuration file, otherwise no timeseries will be visible to the Web Service. Since 2024.02 it is possible to configure more than one filterId</documentation>
				</annotation>
			</element>
			<element name="exportFlagConversionId" type="fews:idStringType" minOccurs="0">
				<annotation>
					<documentation>This must be equal to the name of a flag conversion file located in the FlagConversionsFiles directory. All timeserie values have a 'flag' assigned indicating the quality of the value. However the quality values outside of FEWS can be different that the values assigned by FEWS. With this option the FEWS flags can be translated to external flags. This option can be omitted resulting in no conversion.</documentation>
				</annotation>
			</element>
			<element name="exportUnitConversionId" type="fews:idStringType" minOccurs="0">
				<annotation>
					<documentation>This must be equal to the name of a unit conversion file located in the UnitConversionsFiles directory. Each timeseries represents a parameter variable such as water height or discharge. As is the case with the flags, the FEWS unit used to define the parameter variable can differ from the external unit. With this option the FEWS units can be converted to external units. This option can be omitted resulting in no conversion. N.B. This option is not supported by the WMS Service.</documentation>
				</annotation>
			</element>
			<element name="importUnitConversionId" type="fews:idStringType" minOccurs="0">
				<annotation>
					<documentation>Identical to the export option except that with this option the external units can be converted to FEWS units. This option can be omitted resulting in no conversion. If the units are unknown to FEWS then it is assumed that the values are in the same unit as the import parameter.</documentation>
				</annotation>
			</element>
			<element name="exportIdmapId" type="fews:idStringType" minOccurs="0">
				<annotation>
					<documentation>This mus be equal to the name of a id map file located in the IdMapFiles directory. Each timeseries in FEWS is represented by a combination of; location id, parameter id and 0-n qualifier ids. FEWS again uses its own id values to define locations, parameters and such. In cases where the outside world ids differ this option enables one to translate the internal FEWS ids to external ids. This option can be omitted resulting in the export of the FEWS ids.</documentation>
				</annotation>
			</element>
			<element name="importIdmapId" type="fews:idStringType" minOccurs="0">
				<annotation>
					<documentation>Identical to the export option except that with this option external id are translated to internal FEWS ids. This option can be omitted resulting in the export of the FEWS ids. If the external ids are unknown to FEWS then it will not be possible to map the timeseries and the values will be discarded.</documentation>
				</annotation>
			</element>
			<element name="missingValue" type="string" minOccurs="0">
				<annotation>
					<documentation>Export missing value. All internal NaN values will be mapped to this value. If omitted the default value \-999 will be used.</documentation>
				</annotation>
			</element>
			<element name="omitMissingValues" type="boolean" default="true" minOccurs="0">
				<annotation>
					<documentation>Option to skip the export of missing values when reading timeseries from the FewsPiService (type = true/false). If omitted the default value 'true' is used. Only supported for Digital Delta, UmAquo and WaterML services</documentation>
				</annotation>
			</element>
			<element name="readonlyMode" type="boolean" default="true" minOccurs="0">
				<annotation>
					<documentation>Only read access is allowed to the FEWS Web Services methods if set to true. No create, write, update or execute functionality is allowed. Since 2018.02 readonly mode is enabled by default.</documentation>
				</annotation>
			</element>
			<element name="testPageEnabled" type="boolean" default="false" minOccurs="0">
				<annotation>
					<documentation>Option to enable the testpage. Since 2021.02 the test page is disabled by default. It is also possible to pass a java property to the JVM to enable the testpage: -DTEST_PAGE_ENABLED=true</documentation>
				</annotation>
			</element>
			<element name="corsAllowedOrigins" type="fews:CorsDomainListComplexType" minOccurs="0">
				<annotation>
					<documentation>Since 2021.02 it is possible to configure the CORS headers sent by the FEWS Web Services to limit the allowed origins. This can be used to limit the domains from which javascript web applications can access the FEWS Web Services. If not configured, by default all origins are allowed. To disable all origins, specify the corsAllowedOrigins element without any urls. To allow multiple origins, specify multiple urls.</documentation>
				</annotation>
			</element>
			<element name="permissions" type="fews:WebServicesPermissionsComplexType" minOccurs="0">
				<annotation>
					<documentation>User permission related configuration.</documentation>
				</annotation>
			</element>
			<element name="cardinalTimeStep" type="fews:TimeStepComplexType" minOccurs="0">
				<annotation>
					<documentation>Specifies the cardinal time step that is used to determine timeZero. Currently only used in the systemtime and timeseries endpoint of the piRest Service.</documentation>
				</annotation>
			</element>
			<element name="httpHeaders" type="fews:HttpHeadersComplexType" minOccurs="0" maxOccurs="1">
				<annotation>
					<documentation>Since 2023.02 it is possible to configure if the Web Services should use security header, which is enabled by default.
						In combination with the Web OC specific headers need to be configured in a proxy server like NGINX which may conflict with the default security headers provided by the Web Service.
					</documentation>
				</annotation>
			</element>
		</sequence>
	</complexType>
	<complexType name="WebServicesPermissionsComplexType">
		<sequence>
			<element name="enablePermissions" type="boolean" default="false" minOccurs="0">
				<annotation>
					<documentation>If enabled, the users and groups of Delft-FEWS are applied by the Web Service as well. Default is false.</documentation>
				</annotation>
			</element>
		</sequence>
		<attribute name="defaultUser" type="fews:idStringType">
			<annotation>
				<documentation>If enablePermissions was set to true, it is possible to set the default user. The user has to exist in the userGroups.xml. All requests to the Delft-FEWS Web Services will appear to come from this user which allows configuring dedicated groups and permissions for the webservice.</documentation>
			</annotation>
		</attribute>
	</complexType>
	<complexType name="PiRestServiceComplexType">
		<sequence>
			<element name="timeZone" type="fews:TimeZoneComplexType" minOccurs="0">
				<annotation>
					<documentation>Default time zone. It is strongly recommended to always use GMT-0. If omitted, GMT-0 is used. Request parameters like startTime and endTime will also use this timezone to determine the date.</documentation>
				</annotation>
			</element>
			<element name="idmapQualifierMapping" type="fews:idStringType" minOccurs="0">
				<annotation>
					<documentation>Option to perform more strict filtering by including qualifiers into the IdMapping of the request parameters, default false. This is applicable in case the idmapping contains internal qualifiers, while these not exist in the external parameters. Default there is only a parameter mapping, without mapping qualifiers.</documentation>
				</annotation>
			</element>
			<element name="timeStep" type="string" minOccurs="0">
				<annotation>
					<documentation>Time step name that is used when running a task if no timeStepId is passed as a parameter. Default is: SETS60TZ1</documentation>
				</annotation>
			</element>
			<element name="showSampleTimeseries" type="boolean" default="true" minOccurs="0">
				<annotation>
					<documentation>Option to return timeseries with value type SAMPLE in the getTimeSeries method. If omitted the default value 'false' is used resulting in only SCALAR value types being returned.</documentation>
				</annotation>
			</element>
			<element name="updateFrequencyArchiveSynchronizer" type="long" default="600" minOccurs="0">
				<annotation>
					<documentation>Option to specify the time in seconds between a on the fly synchronization of archive parameters and locations. Default is 10 minutes. Since 2020.01, only for FEWS configurations without a default filter</documentation>
				</annotation>
			</element>
			<element name="defaultRequestParameters" type="fews:DefaultRequestParametersComplexType" minOccurs="0" maxOccurs="unbounded">
				<annotation>
					<documentation>Since 2022.02. Configure default request parameters that can be used in the timeseries endpoint of the PI REST Service.
						In the REST service timeseries endpoint the defaultRequestParametersId is available that should refer to the id of the configured default request parameters.</documentation>
				</annotation>
			</element>
		</sequence>
	</complexType>
	<complexType name="DefaultRequestParametersComplexType">
		<sequence>
			<element name="filterId" type="fews:idStringType" minOccurs="0" maxOccurs="1">
				<annotation>
					<documentation>filterId will be used as the filterId request parameter of the timeseries endpoint</documentation>
				</annotation>
			</element>
			<element name="locationId" type="fews:idStringType" minOccurs="0" maxOccurs="unbounded">
				<annotation>
					<documentation>locationId will be used in the locationIds request parameter of the timeseries endpoint</documentation>
				</annotation>
			</element>
			<element name="parameterId" type="fews:idStringType" minOccurs="0" maxOccurs="unbounded">
				<annotation>
					<documentation>parameterId will be used in the parameterIds request parameter of the timeseries endpoint</documentation>
				</annotation>
			</element>
			<element name="moduleInstanceId" type="fews:idStringType" minOccurs="0" maxOccurs="unbounded">
				<annotation>
					<documentation>moduleInstanceId will be used in the moduleInstanceIds request parameter of the timeseries endpoint</documentation>
				</annotation>
			</element>
			<element name="qualifierId" type="fews:idStringType" minOccurs="0" maxOccurs="unbounded">
				<annotation>
					<documentation>qualifierId will be used in the qualifierIds request parameter of the timeseries endpoint</documentation>
				</annotation>
			</element>
			<element name="ensembleId" type="fews:idStringType" minOccurs="0" maxOccurs="1">
				<annotation>
					<documentation>ensembleId will be used as the ensembleId request parameter of the timeseries endpoint</documentation>
				</annotation>
			</element>
			<element name="ensembleMemberId" type="fews:idStringType" minOccurs="0" maxOccurs="1">
				<annotation>
					<documentation>ensembleMemberId will be used as the ensembleMemberId request parameter of the timeseries endpoint</documentation>
				</annotation>
			</element>
			<element name="timeStepId" type="fews:idStringType" minOccurs="0" maxOccurs="1">
				<annotation>
					<documentation>timeStepId will be used as the timeStepId request parameter of the timeseries endpoint</documentation>
				</annotation>
			</element>
			<element name="exportIdMap" type="fews:idStringType" minOccurs="0" maxOccurs="1">
				<annotation>
					<documentation>exportIdMap will be used as the exportIdMap request parameter of the timeseries endpoint</documentation>
				</annotation>
			</element>
			<element name="exportUnitConversionId" type="fews:idStringType" minOccurs="0" maxOccurs="1">
				<annotation>
					<documentation>exportUnitConversionId will be used as the request exportUnitConversionId parameter of the timeseries endpoint</documentation>
				</annotation>
			</element>
			<element name="timeZoneName" type="fews:timeZoneStringType" minOccurs="0" maxOccurs="1">
				<annotation>
					<documentation>timeZoneName will be used as the timeZoneName request parameter of the timeseries endpoint</documentation>
				</annotation>
			</element>
		</sequence>
		<attribute name="id" type="fews:idStringType">
			<annotation>
				<documentation>If enablePermissions was set to true, it is possible to set the default user. The user has to exist in the userGroups.xml. All requests to the Delft-FEWS Web Services will appear to come from this user which allows configuring dedicated groups and permissions for the webservice.</documentation>
			</annotation>
		</attribute>
	</complexType>

	<complexType name="WmsServiceComplexType">
		<sequence>
			<element name="baseUrl" type="string" minOccurs="0">
				<annotation>
					<documentation>URL that will be reported in the GetCapabilities response as URL to be used to request maps. Required to generate a GetCapabilities response that validatates agains the WMS xsd: https://schemas.opengis.net/wms/1.3.0/capabilities_1_3_0.xsd which is required when integrating with some external tools. The URL typically looks as follows: https://my-server/FewsWebServices/wms.</documentation>
				</annotation>
			</element>
			<element name="clientCacheTimeout" type="long" default="900" minOccurs="0">
				<annotation>
					<documentation>Timeout of the cache in seconds, that is sent to the browser. default is 300 seconds (15 minutes). To disable caching, set the timeout to 0.</documentation>
				</annotation>
			</element>
			<element name="imageMaxWidthHeight" type="long" default="10000000" minOccurs="0">
				<annotation>
					<documentation>The maximum size of the product of the WIDTH and HEIGHT parameters of the GetMap method. For 2020.01 the default is set to 10 million (The default before 2020.01 was set to 2304000, the full HD resolution of 1920x1200). N.B.: The higher this value is set, the more memory is required to generated the WMS images.</documentation>
				</annotation>
			</element>
			<element name="preloadCapabilities" type="boolean" default="false" minOccurs="0">
				<annotation>
					<documentation>The first request to GetCapabilities might take long if a lot of grids are configured. To preload these grids on startup, the WMS_PRELOAD_CAPABILITIES can be set to true. This will make the first request to GetCapabilities fast as well.</documentation>
				</annotation>
			</element>
			<element name="wmsNetcdfDownloadFolder" type="string" minOccurs="0">
				<annotation>
					<documentation>Since 2024.01 When configured all grid netcdf files located on a file server (THREDDS) referenced by the time series in the capabilities are downloaded to this directory
					</documentation>
				</annotation>
			</element>
			<element name="wmsMaxNumberOfCachedLayers" type="long" default="100" minOccurs="0">
				<annotation>
					<documentation>The WMS service uses a LRU cache to limit the memory used on the server. The default size is to cache 100 layers.</documentation>
				</annotation>
			</element>
			<element name="wmsAllowedGridPlotGroupIds" type="fews:AllowedGridPlotGroupIdsComplexType" minOccurs="0">
				<annotation>
					<documentation>Id of the grid plot group which layers will be made available in the WMS service. If not configured, all layers are available. This must be one of the plotgroupids from the GridDisplay.xml (or SpatialDisplay.xml) file located in the DisplayConfigFiles directory. Only the spatial plots defined under this plotgroupid will be visible to the FewsPiService.</documentation>
				</annotation>
			</element>
		</sequence>
	</complexType>
	<complexType name="WfsServiceComplexType">
		<sequence>
			<element name="baseUrl" type="string" minOccurs="0">
				<annotation>
					<documentation>URL that will be reported in the GetCapabilities response, to be used by WFS clients for correct operation of the service.</documentation>
				</annotation>
			</element>
			<element name="nameSpace" type="string" minOccurs="0">
				<annotation>
					<documentation>User xml namespace to use for feature type names in GML in the format "prefix=uri" (default is "fews=http://www.wldelft.nl/fews")</documentation>
				</annotation>
			</element>
			<element name="wfsAllowedGridPlotGroupIds" type="fews:AllowedGridPlotGroupIdsComplexType" minOccurs="0">
				<annotation>
					<documentation>Id of the grid plot group which layers will be made available in the WFS service. If not configured, all layers are available. This must be one of the plotgroupids from the GridDisplay.xml (or SpatialDisplay.xml) file located in the DisplayConfigFiles directory.</documentation>
				</annotation>
			</element>
			<element name="wfsName" type="string" minOccurs="0">
				<annotation>
					<documentation>Service name that will be reported in the GetCapabilities response, (default is "Delft-FEWS WFS").</documentation>
				</annotation>
			</element>
			<element name="wfsTitle" type="string" minOccurs="0">
				<annotation>
					<documentation>Service title that will be reported in the GetCapabilities response, (default is "Delft-FEWS Web Feature Service").</documentation>
				</annotation>
			</element>
			<element name="coordinateSystems" type="fews:CoordinateSystemsComplexType" minOccurs="0">
				<annotation>
					<documentation>Coordinate systems, a list of Coordinate Reference Systems (CRS) codes that will be reported in the GetCapabilities response. FEWS default coordinate system is EPSG:4326.</documentation>
				</annotation>
			</element>
		</sequence>
	</complexType>
	<complexType name="SsdServiceComplexType">
		<sequence>
			<element name="allowedDisplayGroupIds" type="fews:AllowedDisplayGroupIdsComplexType" minOccurs="0">
				<annotation>
					<documentation>only displays part of the configured display group ids will be available using the SSD service.
					</documentation>
				</annotation>
			</element>
		</sequence>
	</complexType>
	<complexType name="WaterMlComplexType">
		<sequence>
			<element name="regionName" type="string" minOccurs="0">
			</element>
			<element name="displayUnits" type="boolean" default="true" minOccurs="0">
			</element>
			<element name="owner" type="string" minOccurs="0">
			</element>
			<element name="website" type="string" minOccurs="0">
			</element>
			<element name="address" type="string" minOccurs="0">
			</element>
			<element name="city" type="string" minOccurs="0">
			</element>
			<element name="contact" type="string" minOccurs="0">
			</element>
			<element name="country" type="string" minOccurs="0">
			</element>
			<element name="email" type="string" minOccurs="0">
			</element>
			<element name="postalCode" type="string" minOccurs="0">
			</element>
			<element name="piVersion" type="fews:piVersionString" minOccurs="0">
			</element>
			<element name="url" type="string" minOccurs="0">
			</element>
			<element name="convertGeoDatum" type="boolean" default="false" minOccurs="0">
			</element>
		</sequence>
	</complexType>

	<complexType name="DigitalDeltaServiceComplexType">
		<sequence>
			<element name="quantityKey" type="string" minOccurs="0">
			</element>
			<element name="parameterKey" type="string" minOccurs="0">
			</element>
			<element name="compartmentKey" type="string" minOccurs="0">
			</element>
			<element name="qualifierKey" type="string" minOccurs="0">
			</element>
			<element name="maxPageSize" type="long" default="100" minOccurs="0">
			</element>
			<element name="dataSourceId" type="string" minOccurs="0">
			</element>
			<element name="dataSourceName" type="string" minOccurs="0">
			</element>
			<element name="nodeId" type="string" minOccurs="0">
			</element>
			<element name="nodeName" type="string" minOccurs="0">
			</element>
			<element name="nodeDescription" type="string" minOccurs="0">
			</element>
			<element name="providerName" type="string" minOccurs="0">
			</element>
			<element name="supportUrl" type="string" minOccurs="0">
			</element>
		</sequence>
	</complexType>

	<complexType name="FilterIdListComplexType">
		<sequence>
			<element name="filterId" type="string" maxOccurs="unbounded">
				<annotation>
					<documentation>This must be one of the filter ids from the Filters.xml file located in the RegionConfigFiles directory. Since 2024.02 it is possible to configure multiple filterIds.</documentation>
				</annotation>
			</element>
		</sequence>
	</complexType>

	<complexType name="CorsDomainListComplexType">
		<sequence>
			<element name="url" type="string" maxOccurs="unbounded">
				<annotation>
					<documentation>Specify one or more urls from which javascript is allowed to interact with the web services. Default access from all domains is allowed. An example of an a url is: https://domain1.com</documentation>
				</annotation>
			</element>
		</sequence>
	</complexType>
	<complexType name="AllowedDisplayGroupIdsComplexType">
		<sequence>
			<element name="displayGroupId" type="fews:idStringType" maxOccurs="unbounded">
				<annotation>
					<documentation>Specify one or more display groups that are allowed to be served by the SSD service.</documentation>
				</annotation>
			</element>
		</sequence>
	</complexType>
	<complexType name="AllowedGridPlotGroupIdsComplexType">
		<sequence>
			<element name="gridPlotGroupId" type="fews:idStringType" maxOccurs="unbounded">
				<annotation>
					<documentation>Specify one or more grid plot group ids that are allowed to be served by the WMS service.</documentation>
				</annotation>
			</element>
		</sequence>
	</complexType>
	<complexType name="OperatingRequestServiceComplexType">
		<sequence>
			<element name="configuration" type="fews:OperatingRequestConfigurationComplexType" minOccurs="1" maxOccurs="unbounded">
				<annotation>
					<documentation>Specify one or more Operating Request Configurations.</documentation>
				</annotation>
			</element>
		</sequence>
	</complexType>
	<complexType name="OperatingRequestConfigurationComplexType">
		<sequence>
			<element name="locationId" type="string">
				<annotation>
					<documentation>Specify the locationId this configuration applies to.</documentation>
				</annotation>
			</element>
			<element name="version" type="string">
				<annotation>
					<documentation>Specify the configuration version of the operating request service for this location.</documentation>
				</annotation>
			</element>
		</sequence>
	</complexType>

	<complexType name="WebOperatorClientConfigurationComplexType">
		<sequence>
			<element name="configFile" type="string">
				<annotation>
					<documentation>Specify the Web OC config file that should be available in the SystemConfigFiles folder.</documentation>
				</annotation>
			</element>
		</sequence>
	</complexType>
	<complexType name="CoordinateSystemsComplexType">
		<sequence>
			<element name="CoordinateSystem" type="fews:idStringType" maxOccurs="unbounded">
				<annotation>
					<documentation>Specify a CSR code in [authority]:[code] format as defined in the EPSG database (epsg.org/).</documentation>
				</annotation>
			</element>
		</sequence>
	</complexType>
	<complexType name="HttpHeadersComplexType">
		<sequence>
			<element name="httpHeadersSecurity" type="fews:HttpHeadersSecurityComplexType" minOccurs="0" maxOccurs="1">
				<annotation>
					<documentation>Allow configuration of the http security headers</documentation>
				</annotation>
			</element>
		</sequence>
	</complexType>
	<complexType name="HttpHeadersSecurityComplexType">
		<sequence>
			<element name="enabled" type="boolean" default="true">
				<annotation>
					<documentation>Default the tomcat HTTP_Header_Security_filter is enabled with its default settings. See also: https://tomcat.apache.org/tomcat-10.0-doc/config/filter.html#HTTP_Header_Security_Filter.
						To disable the HTTP_Header_Security_Filter set this option to false. If set to false, make sure headers are correctly configured in the proxy server (e.g. NGINX) that is used in front of the Web Services.
					</documentation>
				</annotation>
			</element>
		</sequence>
	</complexType>
</schema>
