package com.pas.model;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.hibernate.annotations.ForeignKey;

/**
 * The persistent class for the auth_external database table.
 * 
 */
@Entity
@Table(name="auth_external")
public class AuthExternal implements Serializable {
	private static final long serialVersionUID = 1L;

	@EmbeddedId
	private AuthExternalPK id;

	@Column(name="secret", nullable=false, length=250)
	private String secret;

	@Temporal(TemporalType.DATE)
	@Column(name="updated_at", nullable=false)
	private Date updatedAt;

	@Column(name="username", nullable=false, length=150)
	private String username;

	//bi-directional many-to-one association to UserApp
	@ManyToOne
	@ForeignKey(name = "auth_external_user_app_id_fkey")
	@JoinColumn(name="user_app_id", nullable=false, insertable=false, updatable=false)
	private User user;

	public AuthExternal() {
	}

	public AuthExternal(AuthExternalPK id, User user, String username,
			String secret, Date updatedAt) {
		super();
		this.id = id;
		this.secret = secret;
		this.updatedAt = updatedAt;
		this.username = username;
		this.user = user;
	}

	public AuthExternalPK getId() {
		return this.id;
	}

	public void setId(AuthExternalPK id) {
		this.id = id;
	}

	public String getSecret() {
		return this.secret;
	}

	public void setSecret(String secret) {
		this.secret = secret;
	}

	public Date getUpdatedAt() {
		return this.updatedAt;
	}

	public void setUpdatedAt(Date updatedAt) {
		this.updatedAt = updatedAt;
	}

	public String getUsername() {
		return this.username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public User getUser() {
		return this.user;
	}

	public void setUser(User user) {
		this.user = user;
	}
}