package com.pas.model;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

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.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 * The persistent class for the deal_time database table.
 * 
 */
@Entity
@Table(name="deal_time")
public class DealTime implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	@Column(name="id")
	private Integer id;

	@Temporal(TemporalType.DATE)
	@Column(name="deal_date", nullable=false)
	private Date dealDate;

	@Temporal(TemporalType.DATE)
	@Column(name="deal_time")
	private Date dealTime;

	@Column(name="price", nullable=false)
	private double price;

	@Column(name="price_auction")
	private double priceAuction;

	@Column(name="state", nullable=false, precision=1)
	private BigDecimal state;

	//bi-directional many-to-one association to Deal
	@ManyToOne
	@JoinColumn(name="deal_id", nullable=false)
	private Deal deal;

	//bi-directional many-to-one association to ReserveTime
	@OneToMany(mappedBy="dealTime")
	private List<ReserveTime> reserveTimes;

	public DealTime() {
	}

	public Integer getId() {
		return this.id;
	}

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

	public Date getDealDate() {
		return this.dealDate;
	}

	public void setDealDate(Date dealDate) {
		this.dealDate = dealDate;
	}

	public Date getDealTime() {
		return this.dealTime;
	}

	public void setDealTime(Date dealTime) {
		this.dealTime = dealTime;
	}

	public double getPrice() {
		return this.price;
	}

	public void setPrice(double price) {
		this.price = price;
	}

	public double getPriceAuction() {
		return this.priceAuction;
	}

	public void setPriceAuction(double priceAuction) {
		this.priceAuction = priceAuction;
	}

	public BigDecimal getState() {
		return this.state;
	}

	public void setState(BigDecimal state) {
		this.state = state;
	}

	public Deal getDeal() {
		return this.deal;
	}

	public void setDeal(Deal deal) {
		this.deal = deal;
	}

	public List<ReserveTime> getReserveTimes() {
		return this.reserveTimes;
	}

	public void setReserveTimes(List<ReserveTime> reserveTimes) {
		this.reserveTimes = reserveTimes;
	}

	public ReserveTime addReserveTime(ReserveTime reserveTime) {
		getReserveTimes().add(reserveTime);
		reserveTime.setDealTime(this);

		return reserveTime;
	}

	public ReserveTime removeReserveTime(ReserveTime reserveTime) {
		getReserveTimes().remove(reserveTime);
		reserveTime.setDealTime(null);

		return reserveTime;
	}

}