/**
 * Copyright 2011  OmniOpz
 *
 * The contents of this file are subject to the GNU Lesser General Public
 * License Version 3.0 or later (the "Liecense"); you may not use this file
 * except in compliance with the License.  You may obtain a copy of the
 * License at
 *
 * http://www.gnu.org/licenses/lgpl-3.0-standalone.html
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.omniopz.security;

import java.util.Date;




public class UserLocation {
	private UserLocationKey userLocationKey;
	private int logins;
	private Date firstLogin;
	private Date lastLogin;

	public UserLocation() {
		userLocationKey = new UserLocationKey();
		logins = 0;
	}
	
	public UserLocationKey getUserLocationKey() {
		return userLocationKey;		
	}
	
	public void setUserLocationKey(UserLocationKey key) {
		this.userLocationKey = key;
	}

	public int getLogins() {
		return logins;
	}
	
	public void setLogins(int logins) {
		this.logins = logins;
	}
	
	public Date getFirstLogin() {
		return firstLogin;
	}

	public void setFirstLogin(Date date) {
		this.firstLogin = date;
	}

	public Date getLastLogin() {
		return lastLogin;
	}

	public void setLastLogin(Date date) {
		this.lastLogin = date;
	}

	public void addLogin() {
		logins++;
		Date d = new Date();
		if (firstLogin == null) {
			firstLogin = d;
		}
		lastLogin = d;
	}
}
