/*
 * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
 * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
 */
package com.qsoft.rs.sincoar.model;

import java.io.Serializable;
import java.math.BigDecimal;
import java.math.BigInteger;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.JoinColumns;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author developer2
 */
@Entity
@Table(name="COMACO.TGENESEGMENTRATE")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Tgenesegmentrate.findAll", query = "SELECT t FROM Tgenesegmentrate t"),
    @NamedQuery(name = "Tgenesegmentrate.findByInterestbalancetype", query = "SELECT t FROM Tgenesegmentrate t WHERE t.tgenesegmentratePK.interestbalancetype = :interestbalancetype"),
    @NamedQuery(name = "Tgenesegmentrate.findByInterestbalancegroup", query = "SELECT t FROM Tgenesegmentrate t WHERE t.tgenesegmentratePK.interestbalancegroup = :interestbalancegroup"),
    @NamedQuery(name = "Tgenesegmentrate.findByCreditsegmentcatalog", query = "SELECT t FROM Tgenesegmentrate t WHERE t.tgenesegmentratePK.creditsegmentcatalog = :creditsegmentcatalog"),
    @NamedQuery(name = "Tgenesegmentrate.findByCreditsegmentcatalogcode", query = "SELECT t FROM Tgenesegmentrate t WHERE t.tgenesegmentratePK.creditsegmentcatalogcode = :creditsegmentcatalogcode"),
    @NamedQuery(name = "Tgenesegmentrate.findByCompanycode", query = "SELECT t FROM Tgenesegmentrate t WHERE t.tgenesegmentratePK.companycode = :companycode"),
    @NamedQuery(name = "Tgenesegmentrate.findByCurrencycode", query = "SELECT t FROM Tgenesegmentrate t WHERE t.tgenesegmentratePK.currencycode = :currencycode"),
    @NamedQuery(name = "Tgenesegmentrate.findByRecordversion", query = "SELECT t FROM Tgenesegmentrate t WHERE t.recordversion = :recordversion"),
    @NamedQuery(name = "Tgenesegmentrate.findByMinterm", query = "SELECT t FROM Tgenesegmentrate t WHERE t.tgenesegmentratePK.minterm = :minterm"),
    @NamedQuery(name = "Tgenesegmentrate.findByMaxterm", query = "SELECT t FROM Tgenesegmentrate t WHERE t.maxterm = :maxterm"),
    @NamedQuery(name = "Tgenesegmentrate.findByMinamount", query = "SELECT t FROM Tgenesegmentrate t WHERE t.tgenesegmentratePK.minamount = :minamount"),
    @NamedQuery(name = "Tgenesegmentrate.findByMaxamount", query = "SELECT t FROM Tgenesegmentrate t WHERE t.maxamount = :maxamount"),
    @NamedQuery(name = "Tgenesegmentrate.findByMargin", query = "SELECT t FROM Tgenesegmentrate t WHERE t.margin = :margin"),
    @NamedQuery(name = "Tgenesegmentrate.findByOperator", query = "SELECT t FROM Tgenesegmentrate t WHERE t.operator = :operator"),
    @NamedQuery(name = "Tgenesegmentrate.findByReadjustmentoperator", query = "SELECT t FROM Tgenesegmentrate t WHERE t.readjustmentoperator = :readjustmentoperator"),
    @NamedQuery(name = "Tgenesegmentrate.findByReadjustmentmargin", query = "SELECT t FROM Tgenesegmentrate t WHERE t.readjustmentmargin = :readjustmentmargin"),
    @NamedQuery(name = "Tgenesegmentrate.findByMinrate", query = "SELECT t FROM Tgenesegmentrate t WHERE t.minrate = :minrate"),
    @NamedQuery(name = "Tgenesegmentrate.findByMaxrate", query = "SELECT t FROM Tgenesegmentrate t WHERE t.maxrate = :maxrate")})
public class Tgenesegmentrate implements Serializable {

    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected TgenesegmentratePK tgenesegmentratePK;
    @Column(name = "RECORDVERSION")
    private BigInteger recordversion;
    @Basic(optional = false)
    @Column(name = "MAXTERM")
    private int maxterm;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Column(name = "MAXAMOUNT")
    private BigDecimal maxamount;
    @Column(name = "MARGIN")
    private BigDecimal margin;
    @Column(name = "OPERATOR")
    private String operator;
    @Column(name = "READJUSTMENTOPERATOR")
    private String readjustmentoperator;
    @Column(name = "READJUSTMENTMARGIN")
    private BigDecimal readjustmentmargin;
    @Column(name = "MINRATE")
    private BigDecimal minrate;
    @Column(name = "MAXRATE")
    private BigDecimal maxrate;
    @JoinColumns({
        @JoinColumn(name = "INTERESTBALANCETYPE", referencedColumnName = "BALANCETYPE", insertable = false, updatable = false),
        @JoinColumn(name = "INTERESTBALANCEGROUP", referencedColumnName = "BALANCEGROUP", insertable = false, updatable = false)})
    @ManyToOne(optional = false)
    private Tgenebalancetype tgenebalancetype;
    @JoinColumns({
        @JoinColumn(name = "BASERATECATALOG", referencedColumnName = "BASERATECATALOG"),
        @JoinColumn(name = "BASERATECATALOGCODE", referencedColumnName = "BASERATECATALOGCODE"),
        @JoinColumn(name = "CURRENCYCODE", referencedColumnName = "CURRENCYCODE", insertable = false, updatable = false)})
    @ManyToOne(optional = false)
    private Tgenebaserate tgenebaserate;
    @JoinColumns({
        @JoinColumn(name = "CREDITSEGMENTCATALOG", referencedColumnName = "CATALOG", insertable = false, updatable = false),
        @JoinColumn(name = "CREDITSEGMENTCATALOGCODE", referencedColumnName = "CATALOGCODE", insertable = false, updatable = false)})
    @ManyToOne(optional = false)
    private Tgenecatalogdetail tgenecatalogdetail;
    @JoinColumn(name = "COMPANYCODE", referencedColumnName = "COMPANYCODE", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Tgenecompany tgenecompany;

    public Tgenesegmentrate() {
    }

    public Tgenesegmentrate(TgenesegmentratePK tgenesegmentratePK) {
        this.tgenesegmentratePK = tgenesegmentratePK;
    }

    public Tgenesegmentrate(TgenesegmentratePK tgenesegmentratePK, int maxterm) {
        this.tgenesegmentratePK = tgenesegmentratePK;
        this.maxterm = maxterm;
    }

    public Tgenesegmentrate(String interestbalancetype, String interestbalancegroup, String creditsegmentcatalog, String creditsegmentcatalogcode, long companycode, String currencycode, int minterm, BigDecimal minamount) {
        this.tgenesegmentratePK = new TgenesegmentratePK(interestbalancetype, interestbalancegroup, creditsegmentcatalog, creditsegmentcatalogcode, companycode, currencycode, minterm, minamount);
    }

    public TgenesegmentratePK getTgenesegmentratePK() {
        return tgenesegmentratePK;
    }

    public void setTgenesegmentratePK(TgenesegmentratePK tgenesegmentratePK) {
        this.tgenesegmentratePK = tgenesegmentratePK;
    }

    public BigInteger getRecordversion() {
        return recordversion;
    }

    public void setRecordversion(BigInteger recordversion) {
        this.recordversion = recordversion;
    }

    public int getMaxterm() {
        return maxterm;
    }

    public void setMaxterm(int maxterm) {
        this.maxterm = maxterm;
    }

    public BigDecimal getMaxamount() {
        return maxamount;
    }

    public void setMaxamount(BigDecimal maxamount) {
        this.maxamount = maxamount;
    }

    public BigDecimal getMargin() {
        return margin;
    }

    public void setMargin(BigDecimal margin) {
        this.margin = margin;
    }

    public String getOperator() {
        return operator;
    }

    public void setOperator(String operator) {
        this.operator = operator;
    }

    public String getReadjustmentoperator() {
        return readjustmentoperator;
    }

    public void setReadjustmentoperator(String readjustmentoperator) {
        this.readjustmentoperator = readjustmentoperator;
    }

    public BigDecimal getReadjustmentmargin() {
        return readjustmentmargin;
    }

    public void setReadjustmentmargin(BigDecimal readjustmentmargin) {
        this.readjustmentmargin = readjustmentmargin;
    }

    public BigDecimal getMinrate() {
        return minrate;
    }

    public void setMinrate(BigDecimal minrate) {
        this.minrate = minrate;
    }

    public BigDecimal getMaxrate() {
        return maxrate;
    }

    public void setMaxrate(BigDecimal maxrate) {
        this.maxrate = maxrate;
    }

    public Tgenebalancetype getTgenebalancetype() {
        return tgenebalancetype;
    }

    public void setTgenebalancetype(Tgenebalancetype tgenebalancetype) {
        this.tgenebalancetype = tgenebalancetype;
    }

    public Tgenebaserate getTgenebaserate() {
        return tgenebaserate;
    }

    public void setTgenebaserate(Tgenebaserate tgenebaserate) {
        this.tgenebaserate = tgenebaserate;
    }

    public Tgenecatalogdetail getTgenecatalogdetail() {
        return tgenecatalogdetail;
    }

    public void setTgenecatalogdetail(Tgenecatalogdetail tgenecatalogdetail) {
        this.tgenecatalogdetail = tgenecatalogdetail;
    }

    public Tgenecompany getTgenecompany() {
        return tgenecompany;
    }

    public void setTgenecompany(Tgenecompany tgenecompany) {
        this.tgenecompany = tgenecompany;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (tgenesegmentratePK != null ? tgenesegmentratePK.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 Tgenesegmentrate)) {
            return false;
        }
        Tgenesegmentrate other = (Tgenesegmentrate) object;
        if ((this.tgenesegmentratePK == null && other.tgenesegmentratePK != null) || (this.tgenesegmentratePK != null && !this.tgenesegmentratePK.equals(other.tgenesegmentratePK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.qsoft.rs.sincoar.model.Tgenesegmentrate[ tgenesegmentratePK=" + tgenesegmentratePK + " ]";
    }
    
}
