package com.rjconsultores.ventaboletos.entidad;

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

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
@SequenceGenerator(name = "TARIFA_MINIMA_CATEGORIA_SEQ", sequenceName = "TARIFA_MINIMA_CATEGORIA_SEQ", allocationSize = 1)
@Table(name = "TARIFA_MINIMA_CATEGORIA")
public class TarifaMinimaCategoria implements Serializable {

	private static final long serialVersionUID = 1L;

	@Id
	@Column(name = "TARIFAMINIMACATEGORIA_ID")
	@GeneratedValue(strategy = GenerationType.AUTO, generator = "TARIFA_MINIMA_CATEGORIA_SEQ")
	private Long tarifaminimacategoriaId;

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "CATEGORIA_ID")
	private Categoria categoria;

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "TARIFAMINIMA_ID")
	private TarifaMinima tarifaMinima;

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

	@Column(name = "FECMODIF")
	@Temporal(TemporalType.TIMESTAMP)
	private Date fecmodif;
	
	@Column(name = "USUARIO_ID")
	private Integer usuarioId;

	public Long getTarifaminimacategoriaId() {
		return tarifaminimacategoriaId;
	}

	public void setTarifaminimacategoriaId(Long tarifaminimacategoriaId) {
		this.tarifaminimacategoriaId = tarifaminimacategoriaId;
	}

	public Categoria getCategoria() {
		return categoria;
	}

	public void setCategoria(Categoria categoria) {
		this.categoria = categoria;
	}

	public TarifaMinima getTarifaMinima() {
		return tarifaMinima;
	}

	public void setTarifaMinima(TarifaMinima tarifaMinima) {
		this.tarifaMinima = tarifaMinima;
	}

	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 + ((tarifaminimacategoriaId == null) ? 0 : tarifaminimacategoriaId.hashCode());
		return result;
	}

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

}
