package com.rjconsultores.ventaboletos.entidad;

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

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

import lombok.Getter;
import lombok.Setter;

@Getter
@Setter
@Entity
@SequenceGenerator(name = "EMP_IZIPAY_CONFIG_SEQ", sequenceName = "EMP_IZIPAY_CONFIG_SEQ", allocationSize = 1)
@Table(name = "EMPRESA_IZIPAY_CONFIG")
public class EmpresaIziPayConfig implements Serializable {

	private static final long serialVersionUID = 1L;
	@Id
	@Basic(optional = false)
	@GeneratedValue(strategy = GenerationType.AUTO, generator = "EMP_IZIPAY_CONFIG_SEQ")
	@Column(name = "EMPRESAIZIPAY_ID")
	private Integer empresaIziPayId;
	
	@Column(name = "CLIENT_ID")
	private String clientId;
	
	@Column(name = "SECRET")
	private String secret;
	
	@Column(name = "URL")
	private String url;
	
	@OneToOne
	@JoinColumn(name = "EMPRESA_ID")
	private Empresa empresa;
	
	@Column(name = "ACTIVO")
	private Boolean activo;
	
	@Column(name = "FECMODIF")
	@Temporal(TemporalType.TIMESTAMP)
	private Date fecmodif;
	
	@Column(name = "USUARIO_ID")
	private Integer usuarioId;
	
	@Column(name = "MINUTOS_CANCELA")
	private Integer minutosCancela;

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

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

	@Override
	public String toString() {
		return String.valueOf(this.getEmpresaIziPayId());
	}

}
