/*
 * 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.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.TGENERATESGROUP")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Tgeneratesgroup.findAll", query = "SELECT t FROM Tgeneratesgroup t"),
    @NamedQuery(name = "Tgeneratesgroup.findByInterestbalancetype", query = "SELECT t FROM Tgeneratesgroup t WHERE t.tgeneratesgroupPK.interestbalancetype = :interestbalancetype"),
    @NamedQuery(name = "Tgeneratesgroup.findByInterestbalancegroup", query = "SELECT t FROM Tgeneratesgroup t WHERE t.tgeneratesgroupPK.interestbalancegroup = :interestbalancegroup"),
    @NamedQuery(name = "Tgeneratesgroup.findByRatecatalog", query = "SELECT t FROM Tgeneratesgroup t WHERE t.tgeneratesgroupPK.ratecatalog = :ratecatalog"),
    @NamedQuery(name = "Tgeneratesgroup.findByRatecatalogcode", query = "SELECT t FROM Tgeneratesgroup t WHERE t.tgeneratesgroupPK.ratecatalogcode = :ratecatalogcode"),
    @NamedQuery(name = "Tgeneratesgroup.findByCompanycode", query = "SELECT t FROM Tgeneratesgroup t WHERE t.tgeneratesgroupPK.companycode = :companycode"),
    @NamedQuery(name = "Tgeneratesgroup.findByCurrencycode", query = "SELECT t FROM Tgeneratesgroup t WHERE t.tgeneratesgroupPK.currencycode = :currencycode"),
    @NamedQuery(name = "Tgeneratesgroup.findByRecordversion", query = "SELECT t FROM Tgeneratesgroup t WHERE t.recordversion = :recordversion"),
    @NamedQuery(name = "Tgeneratesgroup.findByMinterm", query = "SELECT t FROM Tgeneratesgroup t WHERE t.tgeneratesgroupPK.minterm = :minterm"),
    @NamedQuery(name = "Tgeneratesgroup.findByMaxterm", query = "SELECT t FROM Tgeneratesgroup t WHERE t.maxterm = :maxterm"),
    @NamedQuery(name = "Tgeneratesgroup.findByMinamount", query = "SELECT t FROM Tgeneratesgroup t WHERE t.tgeneratesgroupPK.minamount = :minamount"),
    @NamedQuery(name = "Tgeneratesgroup.findByMaxamount", query = "SELECT t FROM Tgeneratesgroup t WHERE t.maxamount = :maxamount"),
    @NamedQuery(name = "Tgeneratesgroup.findByMargin", query = "SELECT t FROM Tgeneratesgroup t WHERE t.margin = :margin"),
    @NamedQuery(name = "Tgeneratesgroup.findByOperator", query = "SELECT t FROM Tgeneratesgroup t WHERE t.operator = :operator")})
public class Tgeneratesgroup implements Serializable {

    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected TgeneratesgroupPK tgeneratesgroupPK;
    @Column(name = "RECORDVERSION")
    private BigInteger recordversion;
    @Column(name = "MAXTERM")
    private Integer 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;
    @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 = "RATECATALOG", referencedColumnName = "CATALOG", insertable = false, updatable = false),
        @JoinColumn(name = "RATECATALOGCODE", 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 Tgeneratesgroup() {
    }

    public Tgeneratesgroup(TgeneratesgroupPK tgeneratesgroupPK) {
        this.tgeneratesgroupPK = tgeneratesgroupPK;
    }

    public Tgeneratesgroup(String interestbalancetype, String interestbalancegroup, String ratecatalog, String ratecatalogcode, long companycode, String currencycode, int minterm, BigDecimal minamount) {
        this.tgeneratesgroupPK = new TgeneratesgroupPK(interestbalancetype, interestbalancegroup, ratecatalog, ratecatalogcode, companycode, currencycode, minterm, minamount);
    }

    public TgeneratesgroupPK getTgeneratesgroupPK() {
        return tgeneratesgroupPK;
    }

    public void setTgeneratesgroupPK(TgeneratesgroupPK tgeneratesgroupPK) {
        this.tgeneratesgroupPK = tgeneratesgroupPK;
    }

    public BigInteger getRecordversion() {
        return recordversion;
    }

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

    public Integer getMaxterm() {
        return maxterm;
    }

    public void setMaxterm(Integer 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 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 += (tgeneratesgroupPK != null ? tgeneratesgroupPK.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 Tgeneratesgroup)) {
            return false;
        }
        Tgeneratesgroup other = (Tgeneratesgroup) object;
        if ((this.tgeneratesgroupPK == null && other.tgeneratesgroupPK != null) || (this.tgeneratesgroupPK != null && !this.tgeneratesgroupPK.equals(other.tgeneratesgroupPK))) {
            return false;
        }
        return true;
    }

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