/* ************************************************************************
#
#  DivConq
#
#  http://divconq.com/
#
#  Copyright:
#    Copyright 2012 eTimeline, LLC. All rights reserved.
#
#  License:
#    See the license.txt file in the project's top-level directory for details.
#
#  Authors:
#    * Andy White
#
************************************************************************ */
package divconq.db.common;

import divconq.db.IDatabaseManager;
import divconq.db.UpdateRequest;
import divconq.struct.FieldStruct;
import divconq.struct.RecordStruct;

/**
 * Verify that a session id is valid, must include the user who
 * initiated the session.
 * 
 * @author Andy
 *
 */
public class VerifySessionRequest extends UpdateRequest {
	protected String userid = null;
	protected String authtoken = null;

	/**
	 * @return user id used in query
	 */
	public String getUserId() {
		return this.userid;
	}
	
	/**
	 * @param v user id used in query
	 */
	public void setUserId(String v) {
		this.userid = v;
	}

	/**
	 * @return authtoken used in query
	 */
	public String getAuthToken() {
		return this.authtoken;
	}
	
	/**
	 * @param v authtoken used in query
	 */
	public void setAuthToken(String v) {
		this.authtoken = v;
	}
	
	/**
	 * @param userid for use in query
	 */
	public VerifySessionRequest(String userid, String token) {
		super("dcVerifySession");
		this.userid = userid;
		this.authtoken = token;
	}
	
	/* (non-Javadoc)
	 * @see divconq.db.IDatabaseRequest#getDatabaseParams()
	 */
	@Override
	public RecordStruct getDatabaseParams(IDatabaseManager dbm) {
		return new RecordStruct(
				new FieldStruct("UserId", this.userid),
				new FieldStruct("AuthToken", this.authtoken)
		);
	}
}
