package info.bukova.isspst.data;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.Table;

/**
 * @author Pepa Rokos
 */

@Entity
@Table(name = "TRIP_BILL_APPROVAL")
public class TripBillApproval extends RequirementBase {

	@OneToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "TRIPBILL_ID")
	private TripBill bill;

	@Override
	public String getNumser() {

		if (bill == null) {
			return "";
		}

		TripRequirement tr = bill.getRequirement();

		if (tr == null) {
			return "";
		}

		return tr.getNumser();
	}

	public TripBill getBill() {
		return bill;
	}

	public void setBill(TripBill bill) {
		this.bill = bill;
	}
}
