package cz.bcom.smartrise.server.persistence.hibernate;

// default package

import static javax.persistence.GenerationType.IDENTITY;

import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

/**
 * UsrUsers entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "Usr_Users", catalog = "smart_rise", uniqueConstraints = @UniqueConstraint(columnNames = "Login"))
public class UsrUsers implements java.io.Serializable {
	private static final long serialVersionUID = 8855136190308010703L;
	private Integer id;
	private LocCountryregions locCountryregions;
	private UsrUsers changedBy;
	private UsrUsergroups usrUsergroups;
	private UsrUsers createdBy;
	private LocCountries locCountries;
	private String login;
	private String pwd;
	private String name;
	private String middleName;
	private String surname;
	private Boolean active;
	private String email;
	private Boolean changePassword;
	private Integer defaultLanguage;
	private Date lastSuccessfulLogin;
	private Date lastFailedLogin;
	private Integer failedLoginAttempts;
	private Integer loginDelay;
	private Boolean accountLocked;
	private Boolean lastLoginErrorCode;
	private Boolean checkUserIp;
	private Date dateOfCreation;
	private Date dateOfChange;
	private Integer loginCount;
	private Set<LocCitybranches> locCitybranchesesForChangedBy = new HashSet<LocCitybranches>(0);
	private Set<DataRawdata> dataRawdatas = new HashSet<DataRawdata>(0);
	private Set<TdQuestions> tdQuestionses = new HashSet<TdQuestions>(0);
	private Set<WiWorkingitems> wiWorkingitemses = new HashSet<WiWorkingitems>(0);
	private Set<LocCitybranches> locCitybranchesesForCreatedBy = new HashSet<LocCitybranches>(0);
	private Set<TdElements> tdElementses = new HashSet<TdElements>(0);
	private Set<LocCitybranches> locCitybranchesesForResponsibleId = new HashSet<LocCitybranches>(0);
	private Set<HrEmployees> hrEmployeesesForChangedBy = new HashSet<HrEmployees>(0);
	private Set<UsrUsers> usrUsersesForCreatedBy = new HashSet<UsrUsers>(0);
	private Set<UsrUsers> usrUsersesForChangedBy = new HashSet<UsrUsers>(0);
	private Set<TdDimensions> tdDimensionses = new HashSet<TdDimensions>(0);
	private Set<HrEmployees> hrEmployeesesForCreatedBy = new HashSet<HrEmployees>(0);
	private Set<SecAllowedipaddress> secAllowedipaddresses = new HashSet<SecAllowedipaddress>(0);

	// Constructors

	/** default constructor */
	public UsrUsers() {
	}

	/** minimal constructor */
	public UsrUsers(UsrUsergroups usrUsergroups, LocCountries locCountries, String login, String pwd, Boolean active, Boolean changePassword, Date lastSuccessfulLogin,
			Date lastFailedLogin, Boolean accountLocked, Date dateOfCreation, Date dateOfChange, Integer loginCount) {
		this.usrUsergroups = usrUsergroups;
		this.locCountries = locCountries;
		this.login = login;
		this.pwd = pwd;
		this.active = active;
		this.changePassword = changePassword;
		this.lastSuccessfulLogin = lastSuccessfulLogin;
		this.lastFailedLogin = lastFailedLogin;
		this.accountLocked = accountLocked;
		this.dateOfCreation = dateOfCreation;
		this.dateOfChange = dateOfChange;
		this.loginCount = loginCount;
	}

	/** full constructor */
	public UsrUsers(LocCountryregions locCountryregions, UsrUsers changedBy, UsrUsergroups usrUsergroups, UsrUsers createdBy, LocCountries locCountries,
			String login, String pwd, String name, String middleName, String surname, Boolean active, String email, Boolean changePassword, Integer defaultLanguage,
			Date lastSuccessfulLogin, Date lastFailedLogin, Integer failedLoginAttempts, Integer loginDelay, Boolean accountLocked, Boolean lastLoginErrorCode,
			Boolean checkUserIp, Date dateOfCreation, Date dateOfChange, Integer loginCount, Set<LocCitybranches> locCitybranchesesForChangedBy,
			Set<DataRawdata> dataRawdatas, Set<TdQuestions> tdQuestionses, Set<WiWorkingitems> wiWorkingitemses, Set<LocCitybranches> locCitybranchesesForCreatedBy,
			Set<TdElements> tdElementses, Set<LocCitybranches> locCitybranchesesForResponsibleId, Set<HrEmployees> hrEmployeesesForChangedBy, Set<UsrUsers> usrUsersesForCreatedBy,
			Set<UsrUsers> usrUsersesForChangedBy, Set<TdDimensions> tdDimensionses, Set<HrEmployees> hrEmployeesesForCreatedBy, Set<SecAllowedipaddress> secAllowedipaddresses) {
		this.locCountryregions = locCountryregions;
		this.changedBy = changedBy;
		this.usrUsergroups = usrUsergroups;
		this.createdBy = createdBy;
		this.locCountries = locCountries;
		this.login = login;
		this.pwd = pwd;
		this.name = name;
		this.middleName = middleName;
		this.surname = surname;
		this.active = active;
		this.email = email;
		this.changePassword = changePassword;
		this.defaultLanguage = defaultLanguage;
		this.lastSuccessfulLogin = lastSuccessfulLogin;
		this.lastFailedLogin = lastFailedLogin;
		this.failedLoginAttempts = failedLoginAttempts;
		this.loginDelay = loginDelay;
		this.accountLocked = accountLocked;
		this.lastLoginErrorCode = lastLoginErrorCode;
		this.checkUserIp = checkUserIp;
		this.dateOfCreation = dateOfCreation;
		this.dateOfChange = dateOfChange;
		this.loginCount = loginCount;
		this.locCitybranchesesForChangedBy = locCitybranchesesForChangedBy;
		this.dataRawdatas = dataRawdatas;
		this.tdQuestionses = tdQuestionses;
		this.wiWorkingitemses = wiWorkingitemses;
		this.locCitybranchesesForCreatedBy = locCitybranchesesForCreatedBy;
		this.tdElementses = tdElementses;
		this.locCitybranchesesForResponsibleId = locCitybranchesesForResponsibleId;
		this.hrEmployeesesForChangedBy = hrEmployeesesForChangedBy;
		this.usrUsersesForCreatedBy = usrUsersesForCreatedBy;
		this.usrUsersesForChangedBy = usrUsersesForChangedBy;
		this.tdDimensionses = tdDimensionses;
		this.hrEmployeesesForCreatedBy = hrEmployeesesForCreatedBy;
		this.secAllowedipaddresses = secAllowedipaddresses;
	}

	// Property accessors
	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "ID", unique = true, nullable = false)
	public Integer getId() {
		return this.id;
	}

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

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "RegionID")
	public LocCountryregions getLocCountryregions() {
		return this.locCountryregions;
	}

	public void setLocCountryregions(LocCountryregions locCountryregions) {
		this.locCountryregions = locCountryregions;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "ChangedBy", nullable = true)
	public UsrUsers getChangedBy() {
		return this.changedBy;
	}

	public void setChangedBy(UsrUsers changedBy) {
		this.changedBy = changedBy;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "UserGroupID", nullable = false)
	public UsrUsergroups getUsrUsergroups() {
		return this.usrUsergroups;
	}

	public void setUsrUsergroups(UsrUsergroups usrUsergroups) {
		this.usrUsergroups = usrUsergroups;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "CreatedBy")
	public UsrUsers getCreatedBy() {
		return this.createdBy;
	}

	public void setCreatedBy(UsrUsers createdBy) {
		this.createdBy = createdBy;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "CountryID", nullable = false)
	public LocCountries getLocCountries() {
		return this.locCountries;
	}

	public void setLocCountries(LocCountries locCountries) {
		this.locCountries = locCountries;
	}

	@Column(name = "Login", unique = true, nullable = false, length = 80)
	public String getLogin() {
		return this.login;
	}

	public void setLogin(String login) {
		this.login = login;
	}

	@Column(name = "Pwd", nullable = false, length = 400)
	public String getPwd() {
		return this.pwd;
	}

	public void setPwd(String pwd) {
		this.pwd = pwd;
	}

	@Column(name = "Name", length = 30)
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "MiddleName", length = 30)
	public String getMiddleName() {
		return this.middleName;
	}

	public void setMiddleName(String middleName) {
		this.middleName = middleName;
	}

	@Column(name = "Surname", length = 50)
	public String getSurname() {
		return this.surname;
	}

	public void setSurname(String surname) {
		this.surname = surname;
	}

	@Column(name = "Active", nullable = false)
	public Boolean getActive() {
		return this.active;
	}

	public void setActive(Boolean active) {
		this.active = active;
	}

	@Column(name = "Email", length = 80)
	public String getEmail() {
		return this.email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	@Column(name = "ChangePassword", nullable = false)
	public Boolean getChangePassword() {
		return this.changePassword;
	}

	public void setChangePassword(Boolean changePassword) {
		this.changePassword = changePassword;
	}

	@Column(name = "DefaultLanguage")
	public Integer getDefaultLanguage() {
		return this.defaultLanguage;
	}

	public void setDefaultLanguage(Integer defaultLanguage) {
		this.defaultLanguage = defaultLanguage;
	}

	@Column(name = "LastSuccessfulLogin", nullable = true, length = 19)
	public Date getLastSuccessfulLogin() {
		return this.lastSuccessfulLogin;
	}

	public void setLastSuccessfulLogin(Date lastSuccessfulLogin) {
		this.lastSuccessfulLogin = lastSuccessfulLogin;
	}

	@Column(name = "LastFailedLogin", nullable = true, length = 19)
	public Date getLastFailedLogin() {
		return this.lastFailedLogin;
	}

	public void setLastFailedLogin(Date lastFailedLogin) {
		this.lastFailedLogin = lastFailedLogin;
	}

	@Column(name = "FailedLoginAttempts")
	public Integer getFailedLoginAttempts() {
		return this.failedLoginAttempts;
	}

	public void setFailedLoginAttempts(Integer failedLoginAttempts) {
		this.failedLoginAttempts = failedLoginAttempts;
	}

	@Column(name = "LoginDelay")
	public Integer getLoginDelay() {
		return this.loginDelay;
	}

	public void setLoginDelay(Integer loginDelay) {
		this.loginDelay = loginDelay;
	}

	@Column(name = "AccountLocked", nullable = false)
	public Boolean getAccountLocked() {
		return this.accountLocked;
	}

	public void setAccountLocked(Boolean accountLocked) {
		this.accountLocked = accountLocked;
	}

	@Column(name = "LastLoginErrorCode")
	public Boolean getLastLoginErrorCode() {
		return this.lastLoginErrorCode;
	}

	public void setLastLoginErrorCode(Boolean lastLoginErrorCode) {
		this.lastLoginErrorCode = lastLoginErrorCode;
	}

	@Column(name = "CheckUserIP")
	public Boolean getCheckUserIp() {
		return this.checkUserIp;
	}

	public void setCheckUserIp(Boolean checkUserIp) {
		this.checkUserIp = checkUserIp;
	}

	@Column(name = "DateOfCreation", nullable = false, length = 19)
	public Date getDateOfCreation() {
		return this.dateOfCreation;
	}

	public void setDateOfCreation(Date dateOfCreation) {
		this.dateOfCreation = dateOfCreation;
	}

	@Column(name = "DateOfChange", nullable = true, length = 19)
	public Date getDateOfChange() {
		return this.dateOfChange;
	}

	public void setDateOfChange(Date dateOfChange) {
		this.dateOfChange = dateOfChange;
	}

	@Column(name = "LoginCount", nullable = false)
	public Integer getLoginCount() {
		return this.loginCount;
	}

	public void setLoginCount(Integer loginCount) {
		this.loginCount = loginCount;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "changedBy")
	public Set<LocCitybranches> getLocCitybranchesesForChangedBy() {
		return this.locCitybranchesesForChangedBy;
	}

	public void setLocCitybranchesesForChangedBy(Set<LocCitybranches> locCitybranchesesForChangedBy) {
		this.locCitybranchesesForChangedBy = locCitybranchesesForChangedBy;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "usrUsers")
	public Set<DataRawdata> getDataRawdatas() {
		return this.dataRawdatas;
	}

	public void setDataRawdatas(Set<DataRawdata> dataRawdatas) {
		this.dataRawdatas = dataRawdatas;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "usrUsers")
	public Set<TdQuestions> getTdQuestionses() {
		return this.tdQuestionses;
	}

	public void setTdQuestionses(Set<TdQuestions> tdQuestionses) {
		this.tdQuestionses = tdQuestionses;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "usrUsers")
	public Set<WiWorkingitems> getWiWorkingitemses() {
		return this.wiWorkingitemses;
	}

	public void setWiWorkingitemses(Set<WiWorkingitems> wiWorkingitemses) {
		this.wiWorkingitemses = wiWorkingitemses;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "createdBy")
	public Set<LocCitybranches> getLocCitybranchesesForCreatedBy() {
		return this.locCitybranchesesForCreatedBy;
	}

	public void setLocCitybranchesesForCreatedBy(Set<LocCitybranches> locCitybranchesesForCreatedBy) {
		this.locCitybranchesesForCreatedBy = locCitybranchesesForCreatedBy;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "usrUsers")
	public Set<TdElements> getTdElementses() {
		return this.tdElementses;
	}

	public void setTdElementses(Set<TdElements> tdElementses) {
		this.tdElementses = tdElementses;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "responsible")
	public Set<LocCitybranches> getLocCitybranchesesForResponsibleId() {
		return this.locCitybranchesesForResponsibleId;
	}

	public void setLocCitybranchesesForResponsibleId(Set<LocCitybranches> locCitybranchesesForResponsibleId) {
		this.locCitybranchesesForResponsibleId = locCitybranchesesForResponsibleId;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "changedBy")
	public Set<HrEmployees> getHrEmployeesesForChangedBy() {
		return this.hrEmployeesesForChangedBy;
	}

	public void setHrEmployeesesForChangedBy(Set<HrEmployees> hrEmployeesesForChangedBy) {
		this.hrEmployeesesForChangedBy = hrEmployeesesForChangedBy;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "createdBy")
	public Set<UsrUsers> getUsrUsersesForCreatedBy() {
		return this.usrUsersesForCreatedBy;
	}

	public void setUsrUsersesForCreatedBy(Set<UsrUsers> usrUsersesForCreatedBy) {
		this.usrUsersesForCreatedBy = usrUsersesForCreatedBy;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "changedBy")
	public Set<UsrUsers> getUsrUsersesForChangedBy() {
		return this.usrUsersesForChangedBy;
	}

	public void setUsrUsersesForChangedBy(Set<UsrUsers> usrUsersesForChangedBy) {
		this.usrUsersesForChangedBy = usrUsersesForChangedBy;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "usrUsers")
	public Set<TdDimensions> getTdDimensionses() {
		return this.tdDimensionses;
	}

	public void setTdDimensionses(Set<TdDimensions> tdDimensionses) {
		this.tdDimensionses = tdDimensionses;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "createdBy")
	public Set<HrEmployees> getHrEmployeesesForCreatedBy() {
		return this.hrEmployeesesForCreatedBy;
	}

	public void setHrEmployeesesForCreatedBy(Set<HrEmployees> hrEmployeesesForCreatedBy) {
		this.hrEmployeesesForCreatedBy = hrEmployeesesForCreatedBy;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "usrUsers")
	public Set<SecAllowedipaddress> getSecAllowedipaddresses() {
		return this.secAllowedipaddresses;
	}

	public void setSecAllowedipaddresses(Set<SecAllowedipaddress> secAllowedipaddresses) {
		this.secAllowedipaddresses = secAllowedipaddresses;
	}
	
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((getId()== null) ? 0 : getId().hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj) {
			return true;
		}
		if (obj == null) {
			return false;
		}
		if (!(obj instanceof UsrUsers)) {
			return false;
		}
		UsrUsers other = (UsrUsers) obj;
		if (getId() != null && getId().equals(other.getId())) {
			return true;
		}
		return false;
	}
}