package com.pas.model;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Embeddable;

/**
 * The primary key class for the auth_external database table.
 * 
 */
@Embeddable
public class AuthExternalPK implements Serializable {
	//default serial version id, required for serializable classes.
	private static final long serialVersionUID = 1L;

	@Column(name="user_app_id", unique=true, nullable=false)
	private Integer userAppId;

	@Column(name = "service", unique=true, nullable=false, length=50)
	private String service;

	@Column(name = "token", unique=true, nullable=false, length=250)
	private String token;

	public AuthExternalPK() {
	}
	public AuthExternalPK(Integer userAppId, String service, String token) {
		super();
		this.userAppId = userAppId;
		this.service = service;
		this.token = token;
	}
	public Integer getUserAppId() {
		return this.userAppId;
	}
	public void setUserAppId(Integer userAppId) {
		this.userAppId = userAppId;
	}
	public String getService() {
		return this.service;
	}
	public void setService(String service) {
		this.service = service;
	}
	public String getToken() {
		return this.token;
	}
	public void setToken(String token) {
		this.token = token;
	}

	public boolean equals(Object other) {
		if (this == other) {
			return true;
		}
		if (!(other instanceof AuthExternalPK)) {
			return false;
		}
		AuthExternalPK castOther = (AuthExternalPK)other;
		return 
			this.userAppId.equals(castOther.userAppId)
			&& this.service.equals(castOther.service)
			&& this.token.equals(castOther.token);
	}

	public int hashCode() {
		final int prime = 31;
		int hash = 17;
		hash = hash * prime + this.userAppId.hashCode();
		hash = hash * prime + this.service.hashCode();
		hash = hash * prime + this.token.hashCode();
		
		return hash;
	}
}