package com.rjconsultores.ventaboletos.entidad;

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

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

@Entity
@Table(name = "PRECO_APANHE")
@SequenceGenerator(name = "PRECO_APANHE_SEQ", sequenceName = "PRECO_APANHE_SEQ", allocationSize = 1)
public class PrecoApanhe implements Serializable {

	private static final long serialVersionUID = 1L;

	@Id
	@Basic(optional = false)
	@GeneratedValue(strategy = GenerationType.AUTO, generator = "PRECO_APANHE_SEQ")
	@Column(name = "PRECOAPANHE_ID")
	private Long precoapanheId;

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "HOTEL_ID")
	private Hotel hotel;

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "COLONIA_ID")
	private Colonia colonia;

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "CIUDAD_ID")
	private Ciudad ciudad;

	@Column(name = "PRECO", columnDefinition = "NUMBER(5,2)")
	private BigDecimal preco;

	@Column(name = "ACTIVO")
	private Boolean activo;

	@Column(name = "FECMODIF")
	@Temporal(TemporalType.DATE)
	private Date fecmodif;

	@Column(name = "USUARIO_ID")
	private Integer usuarioId;

	public Long getPrecoapanheId() {
		return precoapanheId;
	}

	public void setPrecoapanheId(Long precoapanheId) {
		this.precoapanheId = precoapanheId;
	}

	public Hotel getHotel() {
		return hotel;
	}

	public void setHotel(Hotel hotel) {
		this.hotel = hotel;
	}

	public Colonia getColonia() {
		return colonia;
	}

	public void setColonia(Colonia colonia) {
		this.colonia = colonia;
	}

	public Ciudad getCiudad() {
		return ciudad;
	}

	public void setCiudad(Ciudad ciudad) {
		this.ciudad = ciudad;
	}

	public BigDecimal getPreco() {
		return preco;
	}

	public void setPreco(BigDecimal preco) {
		this.preco = preco;
	}

	public Boolean getActivo() {
		return activo;
	}

	public void setActivo(Boolean activo) {
		this.activo = activo;
	}

	public Date getFecmodif() {
		return fecmodif;
	}

	public void setFecmodif(Date fecmodif) {
		this.fecmodif = fecmodif;
	}

	public Integer getUsuarioId() {
		return usuarioId;
	}

	public void setUsuarioId(Integer usuarioId) {
		this.usuarioId = usuarioId;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((precoapanheId == null) ? 0 : precoapanheId.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		PrecoApanhe other = (PrecoApanhe) obj;
		if (precoapanheId == null) {
			if (other.precoapanheId != null)
				return false;
		} else if (!precoapanheId.equals(other.precoapanheId))
			return false;
		return true;
	}

}
