<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
<!-- cascade="all|none|save-update|delete|all-delete-orphan"  -->

<hibernate-mapping default-lazy="false" default-cascade="save-update">

    <class table="CENSUS_RESPONSE_INGEST" lazy="false" name="gov.va.med.cds.template.generated.surveys.CensusSurveyResponse" >
      <!-- 
        <id type="java.lang.Long" name="id">
            <column name="CENSUS_RESPONSE_ID"/>
            <generator class="sequence" >
				<param name="sequence">census_response_ing_seq_id</param>
			</generator>
        </id>
        --> 
       
       <id type="java.lang.Long" name="id">
            <column name="CENSUS_RESPONSE_ID"/>
            <generator class="seqhilo" >
				<param name="sequence">census_response_ing_seq_id</param>
				<param name="max_lo">100</param> 
			</generator>
        </id>
      
        <component name="survey" class="gov.va.med.cds.template.generated.surveys.CensusSurvey" >
       		<property name="surveyTitle" column="TITLE" type="java.lang.String" node="title"/>
			<property name="surveyVersion" column="VERSION" type="java.lang.String" node="version"/>
		</component>
		
		<component name="vendor" class="gov.va.med.cds.template.generated.surveys.HTVendor" >
			<property name="vendorNumber" column="VENDOR_FACILITY" type="java.lang.String" />
			<property name="vendorName" column="VENDOR_NAME" type="java.lang.String" />
		</component>
		
		<component name="facility" class="gov.va.med.cds.template.generated.surveys.HTFacilityLocation" >
			<property name="facilityNumber" column="FACILITY_LOCATION" type="java.lang.String"/>	
		</component>
		
		<component name="surveyPatient" class="gov.va.med.cds.template.generated.surveys.CensusSurveyPatient" >
			<property name="icn" column="ICN" type="java.lang.String" node="icn" />
			<property name="ssn" column="SSN" type="java.lang.String" node="ssn" />
			<property name="vendorMRN" column="VENDOR_MRN" type="java.lang.String"/>
			<component name="name" class="gov.va.med.cds.template.generated.surveyscommon.SurveyPersonName">
			 	<property name="given" column="GIVEN_NAME" type="java.lang.String" />
			 	<property name="middle" column="MIDDLE_NAME" type="java.lang.String" />
				<property name="family" column="FAMILY_NAME" type="java.lang.String" />
			</component>
			
			<property name="birthdate" column="BIRTH_DATE_DT" type="java.util.Date"/>			
		</component>
		
		<component name="careCoordinator" class="gov.va.med.cds.template.generated.surveys.HTCareCoordinator">
			<property name="id" column="CC_IDENTIFIER" type="java.lang.String" />
			<component name="name" class="gov.va.med.cds.template.generated.surveyscommon.SurveyPersonName">
				<property name="family" column="CC_FAMILY_NAME" type="java.lang.String"  />
				<property name="given" column="CC_GIVEN_NAME" type="java.lang.String"  />
				<property name="middle" column="CC_MIDDLE_NAME" type="java.lang.String" />
			</component>			
			<property name="facilityNumber" column="CC_FACILITY_NUMBER" type="java.lang.String" />		
		</component>

		<property name="enrollmentDate" column="ENROLLMENT_DT" type="java.util.Date"/>
		<property name="disenrollmentDate" column="DISENRMENT_DT" type="java.util.Date"/>
		<property name="activationDate" column="ACTIVATION_DT" type="java.util.Date"/>
		<property name="inactivationDate" column="INACTIVATION_DT" type="java.util.Date"/>
		<property name="programName" column="PROGRAM_NAME" type="java.lang.String" />
		
		<component name="recordSource" class="gov.va.med.cds.template.generated.basedatatypes.HL72FacilityIdentifier">
			<property name="namespaceId" column="RECORDSOURCE_NAMESPACEID" type="java.lang.String" />
			<property name="universalId" column="RECORDSOURCE_UNIVERSALID" type="java.lang.String" />
			<property name="universalIdType" column="RECORDSOURCE_UNIVERSTYP" type="java.lang.String" />
		</component>
		
        <property name="recordUpdateTime" type="gov.va.med.cds.persistence.hibernate.common.PointInTimeUserType"  >
           <column name="RECORD_CREATION_TM"/>
           <column name="RECORD_CREATION_TM_NBR"/>
        </property>	
        
        <!-- 2013-01-09T07:46:00-05:00 from prod - user type strips ':' from timezone -->
        <property name="submittedDate" column="SUBMITTED_DT" type="java.util.Date"/>
		
		<component name="homeDevice" class="gov.va.med.cds.template.generated.surveys.CensusHomeDevice">
			<property name="model" column="HOME_DEVICE_MODEL" type="java.lang.String"  />
			<property name="serial" column="HOME_DEVICE_SERIAL" type="java.lang.String" />
		</component>
		
		<property name="reportStartDate" column="REPORT_START_DT" type="java.util.Date"/>
		<property name="reportEndDate" column="REPORT_END_DT" type="java.util.Date"/>		
		<property name="levelOfCare" column="LEVEL_OF_CARE" type="java.lang.Integer"/>
		<property name="compliance" column="COMPLIANCE" type="java.lang.Double" />
		
		<component name="responseRate" class="gov.va.med.cds.template.generated.surveys.CensusResponseRate">
			<property name="actual" column="RESPONSE_RATE_ACTUAL" type="java.lang.Integer" />
			<property name="expected" column="RESPONSE_RATE_EXPECTED" type="java.lang.Integer" />
		</component>
		
		<property name="dataAge" column="DATA_AGE" type="java.lang.Integer" node="dataAge"/>

		<property name="requestId" column="REQUEST_ID" type="java.lang.String" node="requestId" />
		
		<property name="dmp" column="DMP" type="java.lang.String" />
		<property name="measurement" column="MEASUREMENTS" type="java.lang.String"  />
		<property name="video" column="VIDEO" type="java.lang.String" />
		<property name="telecom" column="TELECOM" type="java.lang.String" />
		<property name="image" column="IMAGE" type="java.lang.String" />
			
		<!--  
		<many-to-one name="censusMasterSegment" entity-name="censusMasterSegment" column="CENSUS_SEGMENT_ID" unique="true"/>
		-->
		<property name="censusMasterID" column="CENSUS_MASTER_ID" type="java.lang.Long" />
		<property name="censusSegmentID" column="CENSUS_SEGMENT_ID" type="java.lang.Long"  />
	</class>

</hibernate-mapping>
