/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.rjconsultores.ventaboletos.entidad;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
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;

/**
 *
 * @author Administrador
 */
@Entity
@SequenceGenerator(name = "REDONDEO_CTRL_SEQ", sequenceName = "REDONDEO_CTRL_SEQ", allocationSize = 1)
@Table(name = "REDONDEO_CTRL")
public class RedondeoCtrl implements Serializable {

    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO, generator = "REDONDEO_CTRL_SEQ")
    @Basic(optional = false)
    @Column(name = "REDONDEOCTRL_ID")
    private Integer redondeoctrlId;
    @Column(name = "INDAPLICADESCUENTO")
    private Boolean indaplicadescuento;
    @Column(name = "INDAPLICAPRICING")
    private Boolean indaplicapricing;
    @Column(name = "INDAPLICAARTESP")
    private Boolean indaplicaArtesp;
    @Column(name = "ACTIVO")
    private Boolean activo;
    @Column(name = "FECMODIF")
    @Temporal(TemporalType.TIMESTAMP)
    private Date fecmodif;
    @Column(name = "USUARIO_ID")
    private Integer usuarioId;
    @OneToMany(mappedBy = "redondeoCtrl", cascade = CascadeType.ALL)
    private List<RedondeoMarca> redondeoMarcaList;
    @OneToMany(mappedBy = "redondeoCtrl", cascade = CascadeType.ALL)
    private List<Redondeo> redondeoList;

    @OneToMany(mappedBy = "redondeoCtrl", cascade = CascadeType.ALL)
    private List<RedondeoOrgaoConcedente> redondeoOrgaoList;
    
    public RedondeoCtrl() {
    }

    public RedondeoCtrl(Integer redondeoctrlId) {
        this.redondeoctrlId = redondeoctrlId;
    }

    public Integer getRedondeoctrlId() {
        return redondeoctrlId;
    }

    public void setRedondeoctrlId(Integer redondeoctrlId) {
        this.redondeoctrlId = redondeoctrlId;
    }

    public Boolean getIndaplicadescuento() {
        return indaplicadescuento;
    }

    public void setIndaplicadescuento(Boolean indaplicadescuento) {
        this.indaplicadescuento = indaplicadescuento;
    }

    public Boolean getIndaplicapricing() {
        return indaplicapricing;
    }

    public void setIndaplicapricing(Boolean indaplicapricing) {
        this.indaplicapricing = indaplicapricing;
    }

    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<RedondeoMarca> getRedondeoMarcaList() {
        List<RedondeoMarca> rmList = new ArrayList<RedondeoMarca>();
        for (RedondeoMarca rm : this.redondeoMarcaList) {
            if (rm.getActivo() == Boolean.TRUE) {
                rmList.add(rm);
            }
        }
        return rmList;
    }

    public void setRedondeoMarcaList(List<RedondeoMarca> redondeoMarcaList) {
        this.redondeoMarcaList = redondeoMarcaList;
    }

    public List<Redondeo> getRedondeoList() {
        List<Redondeo> rmList = new ArrayList<Redondeo>();
        for (Redondeo rm : this.redondeoList) {
            if (rm.getActivo() == Boolean.TRUE) {
                rmList.add(rm);
            }
        }
        return rmList;
    }

    public void setRedondeoList(List<Redondeo> redondeoList) {
        this.redondeoList = redondeoList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (redondeoctrlId != null ? redondeoctrlId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof RedondeoCtrl)) {
            return false;
        }
        RedondeoCtrl other = (RedondeoCtrl) object;
        if ((this.redondeoctrlId == null && other.redondeoctrlId != null) || (this.redondeoctrlId != null && !this.redondeoctrlId.equals(other.redondeoctrlId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.rjconsultores.ventaboletos.entidad.RedondeoCtrl[redondeoctrlId=" + redondeoctrlId + "]";
    }

	public Boolean getIndaplicaArtesp() {
		return indaplicaArtesp;
	}

	public void setIndaplicaArtesp(Boolean indaplicaArtesp) {
		this.indaplicaArtesp = indaplicaArtesp;
	}

	public List<RedondeoOrgaoConcedente> getRedondeoOrgaoList() {
		List<RedondeoOrgaoConcedente> rmList = new ArrayList<RedondeoOrgaoConcedente>();
		for (RedondeoOrgaoConcedente roc : this.redondeoOrgaoList) {
			if (roc.getActivo() == Boolean.TRUE) {
				rmList.add(roc);
			}
		}

		return rmList;
	}

	public void setRedondeoOrgaoList(List<RedondeoOrgaoConcedente> redondeoOrgaoList) {
		this.redondeoOrgaoList = redondeoOrgaoList;
	}
}
