package info.bukova.isspst.data;

import org.hibernate.annotations.LazyCollection;
import org.hibernate.annotations.LazyCollectionOption;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import java.math.BigDecimal;

@Entity
@Table(name = "WORKFLOW")
public class Workflow extends BaseData {
	
	@Column(name = "CENTRE")
	private Boolean centre;
	@ManyToOne
	@LazyCollection(LazyCollectionOption.FALSE)
	@JoinColumn(name = "ROLE_ID")
	private Role role;
	@Column(name = "WORDER")
	private Integer wOrder;
	@Column(name = "WLIMIT", precision=15, scale=4)
	private BigDecimal limit;
	@Column(name = "SIGNATURE")
	private Boolean signature;

	public Boolean getCentre() {
		return centre;
	}

	public void setCentre(Boolean centre) {
		this.centre = centre;
	}

	public Role getRole() {
		return role;
	}

	public void setRole(Role role) {
		this.role = role;
	}
	
	public boolean equals(Object o) {
		if (o instanceof Workflow
				&& ((Workflow)o).getCentre().equals(centre) 
				&& ((Workflow)o).getRole().equals(role)) {
			return true;
		} 
		
		return false;
	}

	public Integer getOrder() {
		return wOrder;
	}

	public void setOrder(Integer order) {
		this.wOrder = order;
	}

	public BigDecimal getLimit() {
		return limit;
	}

	public void setLimit(BigDecimal limit) {
		this.limit = limit;
	}

	public Boolean getSignature() {
		return signature;
	}

	public void setSignature(Boolean signature) {
		this.signature = signature;
	}
}
