<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:vhimversion="Vhimversion" xmlns:filter="Filter" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" targetNamespace="Filter"
	xsi:schemaLocation="Filter C:\data\hdr\cdsn\main\modules\redrock-core\src\main\java\gov\va\med\cds\filter\schema\Filter100.xsd">
	<!--imports for all non target name spaces -->
	<!-- global definition -->
	<xs:element name="filter">
		<xs:complexType>
			<xs:sequence>
				<xs:element name="filterId" type="filter:FilterId" fixed="PGD_SINGLE_PATIENT_FILTER"/>
				<xs:element name="clientName" minOccurs="0">
					<xs:simpleType>
						<xs:restriction base="xs:string">
							<xs:maxLength value="100"/>
						</xs:restriction>					
					</xs:simpleType>
				</xs:element>
				<xs:element name="clientRequestInitiationTime" type="filter:DateTimeParameter" minOccurs="0"/>
				<!-- Single patient -->
				<xs:element name="patients" type="filter:patient"/>
				<!-- Single entryPointFilter for PatientGeneratedDataEvent ONLY -->
				<xs:element name="entryPointFilter" type="filter:EntryFilter"/>
			</xs:sequence>
			<xs:attribute name="vhimVersion" type="xs:string" use="required" fixed="Vhim_4_00"/>
		</xs:complexType>
	</xs:element>
	<xs:complexType name="patient">
		<xs:choice>
			<xs:element name="resolvedIdentifiers" type="filter:PersonIdentifier" maxOccurs="unbounded"/>
			<xs:sequence>
				<xs:element name="NationalId" type="xs:string"/>
				<xs:element name="excludeIdentifiers" type="filter:ExcludeIdentifier" minOccurs="0" maxOccurs="unbounded"/>
			</xs:sequence>
		</xs:choice>
	</xs:complexType>
	<xs:complexType name="PersonIdentifier">
		<xs:sequence>
			<xs:element name="assigningAuthority" type="xs:string"/>
			<xs:element name="assigningFacility" type="xs:string"/>
			<xs:element name="identity" type="xs:string"/>
		</xs:sequence>
	</xs:complexType>
	<xs:complexType name="ExcludeIdentifier">
		<xs:sequence>
			<xs:element name="assigningAuthority" type="xs:string"/>
			<xs:choice minOccurs="0">
				<xs:sequence>
					<xs:element name="assigningFacility" type="xs:string"/>
					<xs:choice minOccurs="0">
						<xs:element name="identity" type="xs:string"/>
					</xs:choice>
				</xs:sequence>
			</xs:choice>
		</xs:sequence>
	</xs:complexType>
	<!-- ClinicalDocumentEvent entry filter only -->
	<xs:complexType name="EntryFilter">
		<xs:sequence>
			<xs:element name="domainEntryPoint" type="filter:DomainEntryPoint"/>
			<xs:element name="otherQueryParameters" type="filter:AdditionalParameters" minOccurs="0"/>
			<xs:element name="queryTimeoutSeconds" type="xs:string" minOccurs="0"/>
		</xs:sequence>
		<xs:attribute name="queryName" type="xs:ID" use="required"/>
	</xs:complexType>
	<xs:simpleType name="FilterId">
		<xs:restriction base="xs:string"/>
	</xs:simpleType>
	<xs:simpleType name="DomainEntryPoint">
		<xs:restriction base="xs:string">
			<xs:enumeration value="PatientGeneratedDataEvent"/>
		</xs:restriction>
	</xs:simpleType>
	<xs:complexType name="AdditionalParameters">
		<xs:choice>
			<xs:element name="collectionType" type="xs:string" />
		</xs:choice>
	</xs:complexType>
	<xs:simpleType name="DateTimeParameter">
		<xs:restriction base="xs:dateTime"/>
	</xs:simpleType>
</xs:schema>
