<?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="HEALTH_ADAPTER_SINGLE_PATIENT_ALL_DATA_FILTER"/>
				<xs:element name="clientName">
					<xs:simpleType>
						<xs:restriction base="xs:string">
							<xs:maxLength value="100"/>
						</xs:restriction>					
					</xs:simpleType>
				</xs:element>
				<xs:element name="clientRequestInitiationTime" type="filter:DateTimeParameter" />
				<!-- Single patient -->
				<xs:element name="patients" type="filter:patient"/>
				<!-- As many data domains as needed -->
				<xs:element name="entryPointFilter" type="filter:EntryFilter" maxOccurs="unbounded"/>
			</xs:sequence>
			<xs:attribute name="vhimVersion" type="xs:string" use="required" fixed="Vhim_4_00"/>
		</xs:complexType>
	</xs:element>
	<xs:complexType name="patient">
		<xs:sequence>
			<xs:element name="EdiPi" type="filter:PersonIdentifier"/>
		</xs:sequence>
	</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>
	<!-- ClinicalDocumentEvent entry filter only -->
	<xs:complexType name="EntryFilter">
		<xs:sequence>
			<xs:choice>
				<xs:element ref="filter:assessmentDocumentDomainEntryPointFilter"/>
				<xs:element ref="filter:goalTrackingDomainEntryPointFilter"/>
				<xs:element ref="filter:defaultDomainEntryPointFilter"/>
				<xs:element ref="filter:skillTrackingDomainEntryPointFilter"/>
			</xs:choice>
			<xs:element name="startDate" type="filter:DateParameter" minOccurs="0"/>
			<xs:element name="endDate" type="filter:DateParameter" minOccurs="0"/>
		</xs:sequence>
		<xs:attribute name="queryName" type="xs:ID" use="required"/>
	</xs:complexType>
	<xs:simpleType name="DateParameter">
		<xs:restriction base="xs:date"/>
	</xs:simpleType>
	<xs:simpleType name="FilterId">
		<xs:restriction base="xs:string"/>
	</xs:simpleType>
	
	<xs:element name="defaultDomainEntryPointFilter" type="filter:DefaultDomainEntry"/>
	<xs:complexType name="DefaultDomainEntry">
		<xs:sequence>
			<xs:element name="domainEntryPoint" type="filter:DomainEntryPoint"/>
		</xs:sequence>
	</xs:complexType>
	
	<xs:element name="skillTrackingDomainEntryPointFilter" type="filter:SkillTrackingDomainEntry"/>
	<xs:complexType name="SkillTrackingDomainEntry">
		<xs:sequence>
			<xs:element name="domainEntryPoint" type="filter:SkillTrackingDomainEntryPoint"/>
			<xs:element name="otherQueryParameters" type="filter:SkillTrackingOptionalParameters" minOccurs="0"/>
		</xs:sequence>
	</xs:complexType>
	
	<xs:element name="goalTrackingDomainEntryPointFilter" type="filter:GoalTrackingDomainEntry"/>
	<xs:complexType name="GoalTrackingDomainEntry">
		<xs:sequence>
			<xs:element name="domainEntryPoint" type="filter:GoalTrackingDomainEntryPoint"/>
			<xs:element name="otherQueryParameters" type="filter:GoalTrackingOptionalParameters" minOccurs="0"/>
		</xs:sequence>
	</xs:complexType>

	<xs:element name="assessmentDocumentDomainEntryPointFilter" type="filter:AssessmentDocumentDomainEntry"/>
	<xs:complexType name="AssessmentDocumentDomainEntry">
		<xs:sequence>
			<xs:element name="domainEntryPoint" type="filter:AssessmentDocumentDomainEntryPoint"/>
			<xs:element name="otherQueryParameters" type="filter:AssessmentDocumentOptionalParameters" minOccurs="0"/>
		</xs:sequence>
	</xs:complexType>

	<xs:simpleType name="DomainEntryPoint">
		<xs:restriction base="xs:string">
			<xs:enumeration value="PatientEnteredVitalSign"/>
			<xs:enumeration value="PatientEnteredExerciseJournalEntry"/>
			<xs:enumeration value="PatientEnteredDietJournalEntry"/>
			<xs:enumeration value="PatientEnteredContactLogJournalEntry"/>
			<xs:enumeration value="PatientEnteredDailyEventJournalEntry"/>
			<xs:enumeration value="PatientEnteredMoodJournalEntry"/>
			<xs:enumeration value="CalendarEvent"/>
			<xs:enumeration value="PainEvent"/>
			<xs:enumeration value="PainReassessment"/>
			<xs:enumeration value="PainAssessment"/>
		</xs:restriction>
	</xs:simpleType>
	<xs:simpleType name="SkillTrackingDomainEntryPoint">
		<xs:restriction base="xs:string">
			<xs:enumeration value="SkillTracking"/>
		</xs:restriction>
	</xs:simpleType>
		<xs:simpleType name="GoalTrackingDomainEntryPoint">
		<xs:restriction base="xs:string">
			<xs:enumeration value="GoalTracking"/>
		</xs:restriction>
	</xs:simpleType>
	<xs:simpleType name="AssessmentDocumentDomainEntryPoint">
		<xs:restriction base="xs:string">
			<xs:enumeration value="AssessmentDocument"/>
		</xs:restriction>
	</xs:simpleType>

	<xs:simpleType name="DateTimeParameter">
		<xs:restriction base="xs:dateTime"/>
	</xs:simpleType>

	<xs:complexType name="SkillTrackingOptionalParameters">
		<xs:all>
			<xs:element name="skillType" type="xs:string" minOccurs="0"/>
		</xs:all>
	</xs:complexType>
	<xs:complexType name="GoalTrackingOptionalParameters">
		<xs:all>
			<xs:element name="goalName" type="xs:string" minOccurs="0"/>
		</xs:all>
	</xs:complexType>
	<xs:complexType name="AssessmentDocumentOptionalParameters">
		<xs:all>
			<xs:element name="category" type="xs:string" minOccurs="0"/>
		</xs:all>
	</xs:complexType>
</xs:schema>
