package org.bench4q.master.domain.entity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;

@Entity
@Table(name = "user")
public class User {
	private int id;
	private String userName;
	private String password;
	private byte scope;

	// private Set<Script> scripts;

	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column(name = "id", nullable = false)
	public int getId() {
		return id;
	}

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

	@Column(name = "userName", nullable = false)
	public String getUserName() {
		return userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	@Column(name = "password", nullable = false)
	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	@Column(name = "scope", nullable = false)
	public byte getScope() {
		return scope;
	}

	public void setScope(byte scope) {
		this.scope = scope;
	}

	// @OneToMany(cascade = CascadeType.ALL, orphanRemoval = true, fetch =
	// FetchType.LAZY)
	// @JoinColumn(name = "userId")
	// public Set<Script> getScripts() {
	// return scripts;
	// }
	//
	// public void setScripts(Set<Script> scripts) {
	// this.scripts = scripts;
	// }

	// public boolean deleteScript(int scriptId) {
	// for (Script script : this.getScripts()) {
	// if (script.getId() == scriptId) {
	// this.getScripts().remove(script);
	// return true;
	// }
	// }
	// return false;
	// }
	//
	// public boolean addScript(Script scriptWithoutId) {
	// return this.getScripts().add(scriptWithoutId);
	// }
	//
	// public Script getSpecifiedScript(String name) {
	// for (Script script : this.getScripts()) {
	// if (script.getName().equals(name)) {
	// return script;
	// }
	// }
	// return null;
	// }
}
