<?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="topicMessages" type="fews:TopicMessagesComplexType"/>
	<complexType name="TopicMessagesComplexType">
		<sequence>
			<element name="general" type="fews:TopicMessagesGeneralComplexType" minOccurs="0">
				<annotation>
					<documentation>Configurations that apply to all topic messages.</documentation>
				</annotation>
			</element>
			<element name="mailJet" type="fews:MailjetComplexType" minOccurs="0" maxOccurs="unbounded">
				<annotation>
					<documentation>Configurations that apply to mailjet messages.
					</documentation>
				</annotation>
			</element>
		</sequence>
	</complexType>
	<complexType name="TopicMessagesGeneralComplexType">
		<sequence>
			<element name="allowWithoutAuthentication" type="boolean" default="false" minOccurs="0">
				<annotation>
					<documentation>If enabled, messages can be sent to this topic without authentication configured for the Delft-FEWS Web Services. It is assumed authentication is handled outside the WebService.</documentation>
				</annotation>
			</element>
		</sequence>
	</complexType>
	<complexType name="MailjetComplexType">
		<sequence>
			<element name="enabled" type="fews:booleanStringType" default="true" minOccurs="0">
				<annotation>
					<documentation>Determine if a topic is enabled.</documentation>
				</annotation>
			</element>
			<element name="general" type="fews:MailJetGeneralComplexType" 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="topic" type="fews:MailJetTopicComplexType" minOccurs="0" maxOccurs="unbounded">
				<annotation>
					<documentation>Configuration of a mailjet topic.</documentation>
				</annotation>
			</element>
		</sequence>
	</complexType>
	<complexType name="MailJetGeneralComplexType">
		<sequence>
			<element name="apiUrl" type="string" minOccurs="0">
				<annotation>
					<documentation>API URL of Mailjet. If not configured, https://api.mailjet.com is assumed</documentation>
				</annotation>
			</element>
			<element name="apiKey" type="string" >
				<annotation>
					<documentation>Mailjet api key.</documentation>
				</annotation>
			</element>
			<element name="apiSecret" type="string" >
				<annotation>
					<documentation>Mailjet api secret. Never add directly in configuration. Either use a ENV variable or a secure global property</documentation>
				</annotation>
			</element>
		</sequence>
		<attribute name="id" type="fews:idStringType">
			<annotation>
				<documentation>Topic id.</documentation>
			</annotation>
		</attribute>
	</complexType>
	<complexType name="MailJetTopicComplexType">
		<sequence>
			<element name="mailingListName" type="string">
				<annotation>
					<documentation>Mailing list name as used in mailjet</documentation>
				</annotation>
			</element>
			<element name="description" type="string" minOccurs="0">
				<annotation>
					<documentation>Description of the topic</documentation>
				</annotation>
			</element>
			<element name="from" type="string" minOccurs="0">
				<annotation>
					<documentation>Sender from whom the message is sent</documentation>
				</annotation>
			</element>
			<element name="recipientsTarget" type="fews:MessageTargetEnumStringType" default="bcc" minOccurs="0">
				<annotation>
					<documentation>Mailjet recipient target. Determines how a mails is sent to the recipients.</documentation>
				</annotation>
			</element>
			<element name="to" type="string" minOccurs="0">
				<annotation>
					<documentation>Will be ignored if the recipientsTarget is configured with: "to".
						If not specified, the from address will be used.</documentation>
				</annotation>
			</element>
			<element name="sendPermission" type="string" minOccurs="0">
				<annotation>
					<documentation>set a permission to control who can send messages to this topic</documentation>
				</annotation>
			</element>
		</sequence>
		<attribute name="id" type="fews:idStringType">
			<annotation>
				<documentation>Topic id.</documentation>
			</annotation>
		</attribute>
	</complexType>
	<simpleType name="MessageTargetEnumStringType">
		<restriction base="string">
			<enumeration value="to"/>
			<enumeration value="cc"/>
			<enumeration value="bcc"/>
		</restriction>
	</simpleType>

</schema>
