<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">

	<xs:simpleType name="CopyTemplateFormatTypeEnum">
		<xs:restriction base="xs:NCName">
			<xs:enumeration value="HTML"/>
			<xs:enumeration value="UNICODE"/>
		</xs:restriction>
	</xs:simpleType>

	<xs:simpleType name="LanguageId">
		<xs:restriction base="xs:string">
			<xs:pattern value="[A-Z]{2}" />
		</xs:restriction>
	</xs:simpleType>

	<xs:simpleType name="IconTypes">
		<xs:restriction base="xs:NCName">
			<xs:enumeration value="material" />
			<xs:enumeration value="intern" />
			<xs:enumeration value="byImage" />
		</xs:restriction>
	</xs:simpleType>

	<xs:element name="F4SD-CopyTemplate-Configuration">
		<xs:complexType>
			<xs:sequence>
				<xs:element ref="CopyTemplates" minOccurs="1" maxOccurs="1"/>
			</xs:sequence>
		</xs:complexType>
	</xs:element>

	<xs:element name="CopyTemplates">
		<xs:complexType>
			<xs:sequence>
				<xs:element ref="CopyTemplate" minOccurs="0" maxOccurs="unbounded"/>
			</xs:sequence>
			<xs:attribute name="Default" type="xs:string" use="optional"/>
		</xs:complexType>
		<xs:key name ="CopyTemplateId">
			<xs:selector xpath ="./CopyTemplate"/>
			<xs:field xpath ="@Name"/>
		</xs:key>
		<xs:keyref name="CopyTemplateKeyRef" refer="CopyTemplateId">
			<xs:selector xpath="."/>
			<xs:field xpath="@Default"/>
		</xs:keyref>
	</xs:element>

	<xs:element name="CopyTemplate">
		<xs:complexType>
			<xs:sequence>
				<xs:element ref="Name" minOccurs="0" maxOccurs="unbounded"/>
				<xs:element ref="Section" minOccurs="0" maxOccurs="unbounded"/>
				<xs:element ref="Description" minOccurs="0" maxOccurs="unbounded"/>
				<xs:element ref="Icon" minOccurs="0" maxOccurs="1"/>
				<xs:element ref="CopyContent" minOccurs="1" maxOccurs="unbounded"/>
			</xs:sequence>
			<xs:attribute name="Name" type="xs:string" use="optional"/>
			<xs:attribute name="Section" type="xs:NCName" use="optional"/>
			<xs:attribute name="Description" type="xs:string" use="optional"/>
			<xs:attribute name="HiddenInTicketDialog" type="xs:boolean" use="optional" default="false"/>
      <!-- visibility controlling attributes -->
      <xs:attribute name="Hidden" type="xs:boolean" use="optional" default="false"/>
      <xs:attribute name="IsVisibleByParameter" type="xs:string" use="optional" />
      <xs:attribute name="RequiredRoles" use="optional">
        <xs:simpleType>
          <xs:list itemType="xs:NCName" />
        </xs:simpleType>
      </xs:attribute>
    </xs:complexType>
	</xs:element>

	<xs:element name="Name">
		<xs:complexType>
			<xs:simpleContent>
				<xs:extension base="xs:string">
					<xs:attribute name="Lang" type="LanguageId" use="required"/>
				</xs:extension>
			</xs:simpleContent>
		</xs:complexType>
	</xs:element>

	<xs:element name="Section">
		<xs:simpleType>
			<xs:restriction base="xs:NCName" />
		</xs:simpleType>
	</xs:element>

	<xs:element name="Icon">
		<xs:complexType>
			<xs:attribute name="Name" type="xs:NCName" use="required" />
			<xs:attribute name="IconType" type="IconTypes" use="required" />
		</xs:complexType>
	</xs:element>

	<xs:element name="Description">
		<xs:complexType>
			<xs:simpleContent>
				<xs:extension base="xs:string">
					<xs:attribute name="Lang" type="LanguageId" use="required"/>
				</xs:extension>
			</xs:simpleContent>
		</xs:complexType>
	</xs:element>

	<xs:element name="CopyContent">
		<xs:complexType>
			<xs:simpleContent>
				<xs:extension base="xs:string">
					<xs:attribute name="Format" type="CopyTemplateFormatTypeEnum" use="required"/>
				</xs:extension>
			</xs:simpleContent>
		</xs:complexType>
	</xs:element>


</xs:schema>
