<?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="thresholdExport" type="fews:ThresholdExportModuleComplexType">
		<annotation>
			<documentation>The threshold export is a module that exports files based on threshold crossings logged within the same workflow
			</documentation>
		</annotation>
	</element>
	<complexType name="ThresholdExportModuleComplexType">
		<sequence>
			<element name="export" type="fews:ThresholdExportComplexType" minOccurs="1" maxOccurs="unbounded"/>
		</sequence>
	</complexType>
	<complexType name="ThresholdExportComplexType">
		<sequence>
			<element name="exportTypeStandard" type="fews:thresholdExportTypeEnumStringType">
				<annotation>
					<documentation>Name of exportType, currently only CAP_AUS is available</documentation>
				</annotation>
			</element>
			<element name="folder" type="fews:directoryStringType">
				<annotation>
					<documentation>Folder for exported file</documentation>
				</annotation>
			</element>
			<element name="exportFileName" type="fews:ThresholdExportFileNameComplexType">
				<annotation>
					<documentation>Name of exportType, currently only CAP_AUS is available</documentation>
				</annotation>
			</element>
			<sequence minOccurs="0">
				<element name="serverUrl" type="string">
					<annotation>
						<documentation>(Internet) Url to a server to upload the message</documentation>
					</annotation>
				</element>
				<element name="connectionTimeOutMillis" type="int" minOccurs="0">
					<annotation>
						<documentation>Optional timeout in milliseconds before a connection is deemed as unavailable.</documentation>
					</annotation>
				</element>
				<element name="pauseMillis" type="int" minOccurs="0">
					<annotation>
						<documentation>Number of millseconds to pause before sending the next message</documentation>
					</annotation>
				</element>
				<element name="user" type="string">
					<annotation>
						<documentation>User name</documentation>
					</annotation>
				</element>
				<choice>
					<element name="password" type="string">
						<annotation>
							<documentation>Password for user</documentation>
						</annotation>
					</element>
					<element name="encryptedPassword" type="string">
						<annotation>
							<documentation>Encrypted password for user</documentation>
						</annotation>
					</element>
				</choice>
			</sequence>
			<element name="relativeViewPeriod" type="fews:RelativePeriodComplexType" minOccurs="0">
				<annotation>
					<documentation>Not implemented yet</documentation>
				</annotation>
			</element>
			<element name="eventCodePattern" type="fews:nonEmptyStringType" maxOccurs="unbounded">
				<annotation>
					<documentation>e.g *_River_Minor.Down to get Basin1_River_Minor.Down and Basin2_River_Minor.Down.
					</documentation>
				</annotation>
			</element>
			<element name="templateFile" type="fews:fileStringType">
				<annotation>
					<documentation>Name of template file in ReportTemplateFiles</documentation>
				</annotation>
			</element>
			<element name="dateFormat" type="fews:ThresholdExportDateFormatComplexType" minOccurs="0" maxOccurs="unbounded">
				<annotation>
					<documentation>Date format that can be referred to within tags</documentation>
				</annotation>
			</element>
			<element name="numberFormat" type="fews:ThresholdExportNumberFormatComplexType" minOccurs="0" maxOccurs="unbounded">
				<annotation>
					<documentation>Number format that can be referred to within tags</documentation>
				</annotation>
			</element>
			<element name="filter" type="fews:ThresholdLogFilterComplexType" minOccurs="0">
				<annotation>
					<documentation>Filter the threshold crossings based on location sets, parameters.</documentation>
				</annotation>
			</element>
			<element name="thresholdHistorySearchTimeSpan" type="fews:CalendarTimeSpanComplexType">
				<annotation>
					<documentation>Time span to search for previous alert exports, used for determining message type</documentation>
				</annotation>
			</element>
			<element name="eventExpiryTime" type="fews:CalendarTimeSpanComplexType">
				<annotation>
					<documentation>Expiry time for the given alert</documentation>
				</annotation>
			</element>
			<element name="identifier" type="fews:nonEmptyStringType">
				<annotation>
					<documentation>Identifier of the message, must be unique, for example FEWS-%LOCATION_ID%-%EXPORT_TIME(DF1)%</documentation>
				</annotation>
			</element>
			<element name="sender" type="fews:nonEmptyStringType">
				<annotation>
					<documentation>Must be a valid email address</documentation>
				</annotation>
			</element>
			<element name="mapThreshold" type="fews:MapThresholdComplexType" minOccurs="0" maxOccurs="unbounded">
				<annotation>
					<documentation>Mapping between threshold id and it value written to the export file</documentation>
				</annotation>
			</element>
			<sequence minOccurs="0">
				<element name="matchingValueAttributeId" type="string">
					<annotation>
						<documentation>Id of attribute that is used to compare with the value of the time series and take the severity/certainty etc that belongs to that</documentation>
					</annotation>
				</element>
				<element name="multiValuedAttributeTag" type="fews:MultiValuedAttributeTag" maxOccurs="unbounded"/>
			</sequence>
			<choice minOccurs="0">
				<annotation>
					<documentation>
						Since 2023.02. Optional choice for storing export status in the database (table ExportStatus). If this choice is omitted, export status will be stored in database using the
						export folder name as dataFeedId.
					</documentation>
				</annotation>
				<element name="dataFeedId" type="fews:idStringType">
					<annotation>
						<documentation>Id for data feed. Export status will be stored in database using this id</documentation>
					</annotation>
				</element>
				<element name="disableDataFeedInfo" type="fews:emptyElement">
					<annotation>
						<documentation>Option disableDataFeedInfo indicates that no export status should be stored in database</documentation>
					</annotation>
				</element>
			</choice>
		</sequence>
	</complexType>
	<complexType name="ThresholdExportFileNameComplexType">
		<annotation>
			<documentation>Defines how the export filename must be composed. If no of the elements name, prefix and suffix is specified, the file name is not valid (is checked in the source code).
			</documentation>
		</annotation>
		<sequence>
			<element name="name" type="string"/>
			<element name="prefix" type="fews:AdditionComplexType" minOccurs="0"/>
			<element name="suffix" type="fews:AdditionComplexType" minOccurs="0"/>
		</sequence>
	</complexType>
	<complexType name="ThresholdExportDateFormatComplexType">
		<sequence>
			<element name="timeZone" type="fews:TimeZoneComplexType" minOccurs="0">
				<annotation>
					<documentation>Optional time zone for this dateFormat. If no time zone is defined, then uses GMT.</documentation>
				</annotation>
			</element>
			<element name="dateTimePattern" type="fews:nonEmptyStringType">
				<annotation>
					<documentation>Pattern for this dateFormat. This can be e.g. "yyyy-MM-dd HH:mm:ss".</documentation>
				</annotation>
			</element>
		</sequence>
		<attribute name="id" type="fews:idStringType" use="required">
			<annotation>
				<documentation>Identifier for this dateFormat. Use this identifier to reference to this dateFormat in a tag in the text of an svg object.</documentation>
			</annotation>
		</attribute>
	</complexType>
	<complexType name="ThresholdExportNumberFormatComplexType">
		<sequence>
			<element name="pattern" type="fews:nonEmptyStringType">
				<annotation>
					<documentation>Pattern for this numberFormat. This can be e.g. "{0,number,#.##}" to get data values that are rounded to two decimal places.</documentation>
				</annotation>
			</element>
		</sequence>
		<attribute name="id" type="fews:idStringType" use="required">
			<annotation>
				<documentation>Identifier for this numberFormat. Use this identifier to reference to this numberFormat in a tag in the text of an svg object.</documentation>
			</annotation>
		</attribute>
	</complexType>
	<complexType name="ThresholdLogFilterComplexType">
		<sequence>
			<element name="locationSetId" type="fews:idStringType" minOccurs="0" maxOccurs="unbounded"/>
			<element name="parameterId" type="fews:idStringType" minOccurs="0" maxOccurs="unbounded"/>
		</sequence>
	</complexType>
	<complexType name="MapThresholdComplexType">
		<attribute name="thresholdId" type="fews:idStringType" use="required"/>
		<attribute name="value" type="fews:idStringType" use="required"/>
	</complexType>
	<simpleType name="thresholdExportTypeEnumStringType">
		<annotation>
			<documentation>Overview of supported export types</documentation>
		</annotation>
		<restriction base="string">
			<enumeration value="CAP-AU">
				<annotation>
					<documentation>CAP-AU, format used in Australia</documentation>
				</annotation>
			</enumeration>
			<enumeration value="CAP-EA">
				<annotation>
					<documentation>CAP-EA, format used in UK</documentation>
				</annotation>
			</enumeration>
		</restriction>
	</simpleType>
	<complexType name="MultiValuedAttributeTag">
		<sequence>
			<element name="tag" type="fews:nonEmptyStringType"/>
			<element name="upCrossingAttributeId" type="fews:idStringType"/>
			<element name="downCrossingAttributeId" type="fews:idStringType"/>
		</sequence>
	</complexType>
</schema>