package gov.va.med.esr.service;

import gov.va.med.esr.common.model.ee.VerificationInfo;
import gov.va.med.esr.common.model.financials.FinancialStatement;
import gov.va.med.esr.common.model.financials.SpouseFinancials;
import gov.va.med.esr.common.model.lookup.AACIndicator;
import gov.va.med.esr.common.model.lookup.AddressType;
import gov.va.med.esr.common.model.lookup.AuthenticationLevel;
import gov.va.med.esr.common.model.lookup.Country;
import gov.va.med.esr.common.model.lookup.EmploymentStatus;
import gov.va.med.esr.common.model.lookup.EnrollmentPriorityGroup;
import gov.va.med.esr.common.model.lookup.Gender;
import gov.va.med.esr.common.model.lookup.MessageType;
import gov.va.med.esr.common.model.lookup.VAFacility;
import gov.va.med.esr.common.model.lookup.VOAApplicationStatus;
import gov.va.med.esr.common.model.lookup.VOAFormType;
import gov.va.med.esr.common.model.lookup.VeteranIdentifierType;
import gov.va.med.esr.common.model.person.Person;
import gov.va.med.esr.common.model.person.Spouse;
import gov.va.med.esr.common.model.person.VOAApplication;
import gov.va.med.esr.common.model.person.id.PersonIdEntityKeyImpl;
import gov.va.med.esr.common.rule.parameter.EmploymentInputParameter;
import gov.va.med.esr.common.util.RuleAbstractTestCase;
import gov.va.med.fw.rule.SimpleRuleMethod;

import java.math.BigDecimal;
import java.net.URLEncoder;
import java.net.URLDecoder;
import java.util.Calendar;
import java.util.Date;
public class VOAProcessAddressTest extends RuleAbstractTestCase {

	public VOAProcessAddressTest(String arg0) {
		super(arg0);
	}
	
//	
//	public void testProcessAddressLine1To3() throws Exception {
//		
//		//VAFacility.CODE_MHV
//		VAFacility fac = this.getLookupService().getVaFacilityByCode(VAFacility.CODE_MHV.getCode());
//		String vpid ="1008590759V367283";
//
//		Person onFile = this.doBuildSimplePerson(true, vpid, null);
//		
////		Person onFile = this.buildSimplePerson();
//
//		Person incoming = this.savePerson(onFile);
//
//		//add simple  Perm address "Clairmont Dr, Atlanta,GA 30305"
//		//with now as updatedDate and null endDate */
//		this.addPermanentAddress(incoming, Calendar.getInstance().getTime(),null);
//		incoming.getPermanentAddress().setLine2("Address Line 2");
//		incoming.getPermanentAddress().setLine3("Address Line 3");
//		incoming.getPermanentAddress().setCountry(null);
//		
//		VerificationInfo vi = new VerificationInfo("x",	MessageType.CODE_ORUZ07_TO_ESR.getCode(), "x");
////		vi.setSiteNumber(incoming.getEligibilityVerification().getVerificationFacility().getCode());
//		Person updated = this.getMessagingService().processVOA(incoming, onFile, fac,vi);
//		
//		assertEquals("CLAIRMONT DR", updated.getPermanentAddress().getLine1());
//		assertEquals("ADDRESS LINE 2", updated.getPermanentAddress().getLine2());
//		assertEquals( "ADDRESS LINE 3", updated.getPermanentAddress().getLine3());
//		//5.5.1.	SUC2031.17.1 - Permanent Address Country Not Required
//		assertEquals(Country.CODE_USA.getName(), updated.getPermanentAddress().getCountry()); //if null, default to United States
//	}	
//	
//	public void testProcessAddressNullLine2To3() throws Exception {
//		
//		//VAFacility.CODE_MHV
//		VAFacility fac = this.getLookupService().getVaFacilityByCode(VAFacility.CODE_MHV.getCode());
//		String vpid ="1008590759V367283";
//
//		Person onFile = this.doBuildSimplePerson(true, vpid, null);
//
//		Person incoming = this.savePerson(onFile);
//
//		//add simple  Perm address "Clairmont Dr, Atlanta,GA 30305"
//		//with now as updatedDate and null endDate */
//		this.addPermanentAddress(incoming, Calendar.getInstance().getTime(),null);
//		//5.4.1.	SUC2031.16.1 - Permanent Street Address Line 2 Not Required
//		//5.4.2.	SUC2031.16.2 - Permanent Street Address Line 3 Not Required
//		incoming.getPermanentAddress().setLine2(null);
//		incoming.getPermanentAddress().setLine3(null);
//		incoming.getPermanentAddress().setCountry(Country.CODE_PHILIPPINES.getName());
//		
//		
//		VerificationInfo vi = new VerificationInfo("x",	MessageType.CODE_ORUZ07_TO_ESR.getCode(), "x");
//		Person updated = this.getMessagingService().processVOA(incoming, onFile, fac,vi);
//
//		assertEquals(Country.CODE_PHILIPPINES.getName(), updated.getPermanentAddress().getCountry()); //if null, default to United States
//		assertEquals("CLAIRMONT DR", updated.getPermanentAddress().getLine1());
//		assertEquals(null, updated.getPermanentAddress().getLine2());
//		assertEquals(null, updated.getPermanentAddress().getLine3());
//	}	
//	
//	//4.2.1.1	SUC2031.3.2.1 - [1469] Process Person Address Data Decision Table
//	public void testProcessAddressDecisionTable_ruleN()
//	{
//		return;
//	}
//	
//	public void testProcessVOA_1() throws Exception
//	{
//		VOAApplication app = createDefaultVOAApplication("1606259944", new Date(1982,10,11), "AHADH", "HADHA", "M", "432724753" );
//		this.getVoaApplicationService().save(app);
//		BigDecimal appId = (BigDecimal) app.getEntityKey().getKeyValue();
//		Person person = (Person)this.getPerson("375328770").clone();
//		person.setIdentifier(null);
//		this.getVoaApplicationService().processVoaApplication(appId, person);
//		
//	}
//	
//	protected VOAApplication createDefaultVOAApplication(String edipi, Date birthDate, String firstName, String lastName, String gender, String ssn) throws Exception 
//	{
//		VOAApplication app = new VOAApplication();
//		app.setApplicationStatus((VOAApplicationStatus) this
//				.getLookupService().getByCode(VOAApplicationStatus.class,
//						VOAApplicationStatus.FORM_SUBMITTED));
//		
//		app.setAuthenticationLevel((AuthenticationLevel) this
//				.getLookupService().getByCode(AuthenticationLevel.class,
//						AuthenticationLevel.DS_LOGON_LEVEL_2));
//		app.setFullQualifiedId(edipi + "^NI^200DOD^USDOD");
//		app.setIdentityType((VeteranIdentifierType) this
//				.getLookupService().getByCode(VeteranIdentifierType.class,
//						VeteranIdentifierType.CODE_EDIPI));
//		app.setFormType((VOAFormType) this
//				.getLookupService().getByCode(VOAFormType.class,
//						VOAFormType.VOA_FORM_1010EZ));
//		app.setFirstName(firstName);
//		app.setLastName(lastName);
//		app.setSsn(ssn);
//		app.setDateOfBirth(birthDate);
//		app.setGender(this.getLookupService().getGenderByCode(gender));
//		
//		return app;
//		
//	}
}