package th.go.dss.mstq.model.onestop;

import java.io.Serializable;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OrderColumn;
import javax.persistence.Table;
import javax.persistence.TableGenerator;

import com.fasterxml.jackson.annotation.JsonIdentityInfo;
import com.fasterxml.jackson.annotation.ObjectIdGenerators;

import th.go.dss.mstq.model.Standard;

@Entity
@Table(name="rfq_products")
@JsonIdentityInfo(generator=ObjectIdGenerators.PropertyGenerator.class, property="id")
public class RfqProduct implements Serializable {

	
	/**
	 * 
	 */
	private static final long serialVersionUID = 632776316412692994L;

	@Id
	@GeneratedValue(generator="table", strategy=GenerationType.TABLE)
	@TableGenerator(name = "table", allocationSize = 10)
	private Long id;
	
	@ManyToOne
	@JoinColumn(name="rfq_id")
	private Rfq rfq;
	
	@Column(name="remark")
	private String remark;
	
	@ManyToOne
	@JoinColumn(name="product_id")
	private Standard product;
	
	@Column(name="product_index")
	private Integer productIndex;
	
	@OneToMany(cascade = CascadeType.ALL, mappedBy="product")
	@OrderColumn(name="stdparam_index")
	private List<RfqItem> items;
	
	public Long getId() {
		return id;
	}

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

	public Rfq getRfq() {
		return rfq;
	}

	public void setRfq(Rfq rfq) {
		this.rfq = rfq;
	}

	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	public Standard getProduct() {
		return product;
	}

	public void setProduct(Standard product) {
		this.product = product;
	}

	public List<RfqItem> getItems() {
		return items;
	}

	public void setItems(List<RfqItem> items) {
		this.items = items;
	}

	public Integer getProductIndex() {
		return productIndex;
	}

	public void setProductIndex(Integer productIndex) {
		this.productIndex = productIndex;
	}
	
	
}
