package com.rjconsultores.ventaboletos.entidad;

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

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

@Entity
@SequenceGenerator(name = "REGION_METROPOLITANA_SEQ", sequenceName = "REGION_METROPOLITANA_SEQ", allocationSize = 1)
@Table(name = "REGION_METROPOLITANA")
public class RegionMetropolitana implements Serializable {

	private static final long serialVersionUID = 1L;
	@Id
	@Basic(optional = false)
	@GeneratedValue(strategy = GenerationType.AUTO, generator = "REGION_METROPOLITANA_SEQ")
	@Column(name = "REGIONMETROPOLITANA_ID")
	private Long regionMetropolitanaId;
	@Column(name = "DESCREGION")
	private String descRegion;
	@Column(name = "ACTIVO")
	private Boolean activo;
	@Column(name = "FECMODIF")
	@Temporal(TemporalType.TIMESTAMP)
	private Date fecmodif;
	@Column(name = "USUARIO_ID")
	private Integer usuarioId;
	@OneToMany(mappedBy = "regionMetropolitana" , fetch = FetchType.EAGER)
	private List<Parada> paradaList;

	public Long getRegionMetropolitanaId() {
		return regionMetropolitanaId;
	}

	public void setRegionMetropolitanaId(Long regionMetropolitanaId) {
		this.regionMetropolitanaId = regionMetropolitanaId;
	}

	public String getDescRegion() {
		return descRegion;
	}

	public void setDescRegion(String descRegion) {
		this.descRegion = descRegion;
	}

	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;
	}

	public List<Parada> getParadaList() {
		return paradaList;
	}

	public void setParadaList(List<Parada> paradaList) {
		this.paradaList = paradaList;
	}
	
	@Override
	public int hashCode() {
		int hash = 0;
		hash += (regionMetropolitanaId != null ? regionMetropolitanaId.hashCode() : 0);
		return hash;
	}

	@Override
	public boolean equals(Object object) {
		if (!(object instanceof RegionMetropolitana)) {
			return false;
		}
		RegionMetropolitana other = (RegionMetropolitana) object;
		if ((regionMetropolitanaId == null && other.regionMetropolitanaId != null) || (this.regionMetropolitanaId != null && !this.regionMetropolitanaId.equals(other.regionMetropolitanaId))) {
			return false;
		}
		return true;
	}

	@Override
	public String toString() {
		if (getDescRegion() != null || regionMetropolitanaId != null) {
			return this.getDescRegion() + " - " + regionMetropolitanaId;
		}
		return " ";
	}



}
