/**
 * @constructor
 * @private
 */
function DossierImp()
{
	throw new Error("DossierImp is a static class. Do not instantiate.");
}

DossierImp.DEFAULT_DOMAIN = "web.lexisnexis.com";

// Create API Matrix
// The matrix is used to cast object elements into those used by the API.
DossierImp.matrix          = new Object();

// Filter out MQ fields that we don't want in the query string
// DossierImp.matrix.pwd      = -1;
// DossierImp.matrix.uid      = -1;
DossierImp.matrix.domain        = -1;
DossierImp.matrix.protocol      = -1;
DossierImp.matrix.lastName      = -1;
DossierImp.matrix.firstName     = -1;
// DossierImp.matrix.companyName   = -1;
DossierImp.matrix.ssn           = -1;
DossierImp.matrix.streetAddress = -1;	
// DossierImp.matrix.city          = -1;	
DossierImp.matrix.apinoadf      = -1;	
DossierImp.matrix.TOCTarget     = -1;	

	
// Describe which field names you need to cast into other values
// specific to the API.
DossierImp.matrix.client          = "clientid";
DossierImp.matrix.menu            = -1;
DossierImp.matrix.originationCode = "ORIGINATION_CODE";	
DossierImp.matrix.search          = "name";
DossierImp.matrix.source          = -1;
DossierImp.matrix.uid             = "USER_ID";
DossierImp.matrix.pwd             = "PASSWORD";	

DossierImp.matrix.state           = "StateList";
DossierImp.matrix.zip		      = "zipcode";


/**
 * This matric 
 */
DossierImp.submit = function(chunnel)
{
	// Preprocessor needs to convert generic after field 
	// to XLink's relativedate field
	chunnel = DossierImp._preprocessor(chunnel);

	var linker = DossierImp.getLink(chunnel);

	// If no target, set the target for the same window.	
	if (!Truth.isTrue(chunnel.target))
	{
		chunnel.target = "_self";
	}
	
	// prompt("", linker)
	// And send it on its merry way
	var w = window.open(linker, chunnel.target, NEW_WINDOW_FEATURES); 

};

/**
 * Take any actions that need to be made on the MQ object before it gets
 * submitted to its specific API.
 */
DossierImp._preprocessor =  function(chunnel)
{
	if (Truth.isTrue(chunnel.pwd))
	{
		chunnel.protocol = "https:";
		if (!Truth.isTrue(chunnel.get("LNAUTHSCHEME")))
		{
			chunnel.set("LNAUTHSCHEME", "C");
		}
	}
	
	if (!Truth.isTrue(chunnel.get("prod")))
	{
		chunnel.set("prod", "CD")
	}
	
	return chunnel;
}

DossierImp.getLink = function(chunnel)
{
	var domain = DossierImp.DEFAULT_DOMAIN;
	
	if (chunnel.domain && chunnel.domain !== "") 
	{
		domain = chunnel.domain;
	}

	domain = domain.replace("lexis-nexis", "lexisnexis");

	var action;
	
	if (Truth.isTrue(chunnel.override))
	{
		action = chunnel.override;
	}
	else
	{
		action = chunnel.protocol + "//" + domain + "/api.universe/v1_dossier_launch_results";
	}

	return action + "?" + SearchImplementor.getQueryString(chunnel, DossierImp.matrix);

};
