/*
 * 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 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.TGENESUBPRODUCTCHARGES")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Tgenesubproductcharges.findAll", query = "SELECT t FROM Tgenesubproductcharges t"),
    @NamedQuery(name = "Tgenesubproductcharges.findByBalancetype", query = "SELECT t FROM Tgenesubproductcharges t WHERE t.tgenesubproductchargesPK.balancetype = :balancetype"),
    @NamedQuery(name = "Tgenesubproductcharges.findByBalancegroup", query = "SELECT t FROM Tgenesubproductcharges t WHERE t.tgenesubproductchargesPK.balancegroup = :balancegroup"),
    @NamedQuery(name = "Tgenesubproductcharges.findByModulecode", query = "SELECT t FROM Tgenesubproductcharges t WHERE t.tgenesubproductchargesPK.modulecode = :modulecode"),
    @NamedQuery(name = "Tgenesubproductcharges.findByProductcode", query = "SELECT t FROM Tgenesubproductcharges t WHERE t.tgenesubproductchargesPK.productcode = :productcode"),
    @NamedQuery(name = "Tgenesubproductcharges.findBySubproductcode", query = "SELECT t FROM Tgenesubproductcharges t WHERE t.tgenesubproductchargesPK.subproductcode = :subproductcode"),
    @NamedQuery(name = "Tgenesubproductcharges.findByStatuscode", query = "SELECT t FROM Tgenesubproductcharges t WHERE t.tgenesubproductchargesPK.statuscode = :statuscode"),
    @NamedQuery(name = "Tgenesubproductcharges.findByCompanycode", query = "SELECT t FROM Tgenesubproductcharges t WHERE t.tgenesubproductchargesPK.companycode = :companycode"),
    @NamedQuery(name = "Tgenesubproductcharges.findByCurrencycode", query = "SELECT t FROM Tgenesubproductcharges t WHERE t.tgenesubproductchargesPK.currencycode = :currencycode"),
    @NamedQuery(name = "Tgenesubproductcharges.findByRatesequence", query = "SELECT t FROM Tgenesubproductcharges t WHERE t.tgenesubproductchargesPK.ratesequence = :ratesequence"),
    @NamedQuery(name = "Tgenesubproductcharges.findByRate", query = "SELECT t FROM Tgenesubproductcharges t WHERE t.rate = :rate"),
    @NamedQuery(name = "Tgenesubproductcharges.findByPercent", query = "SELECT t FROM Tgenesubproductcharges t WHERE t.percent = :percent"),
    @NamedQuery(name = "Tgenesubproductcharges.findByMinvalue", query = "SELECT t FROM Tgenesubproductcharges t WHERE t.minvalue = :minvalue"),
    @NamedQuery(name = "Tgenesubproductcharges.findByMaxvalue", query = "SELECT t FROM Tgenesubproductcharges t WHERE t.maxvalue = :maxvalue"),
    @NamedQuery(name = "Tgenesubproductcharges.findByMinamount", query = "SELECT t FROM Tgenesubproductcharges t WHERE t.minamount = :minamount"),
    @NamedQuery(name = "Tgenesubproductcharges.findByMaxamount", query = "SELECT t FROM Tgenesubproductcharges t WHERE t.maxamount = :maxamount")})
public class Tgenesubproductcharges implements Serializable {

    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected TgenesubproductchargesPK tgenesubproductchargesPK;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Column(name = "RATE")
    private BigDecimal rate;
    @Column(name = "PERCENT")
    private BigDecimal percent;
    @Column(name = "MINVALUE")
    private BigDecimal minvalue;
    @Column(name = "MAXVALUE")
    private BigDecimal maxvalue;
    @Basic(optional = false)
    @Column(name = "MINAMOUNT")
    private BigDecimal minamount;
    @Column(name = "MAXAMOUNT")
    private BigDecimal maxamount;
    @JoinColumns({
        @JoinColumn(name = "BALANCETYPE", referencedColumnName = "BALANCETYPE", insertable = false, updatable = false),
        @JoinColumn(name = "BALANCEGROUP", referencedColumnName = "BALANCEGROUP", insertable = false, updatable = false)})
    @ManyToOne(optional = false)
    private Tgenebalancetype tgenebalancetype;
    @JoinColumn(name = "COMPANYCODE", referencedColumnName = "COMPANYCODE", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Tgenecompany tgenecompany;
    @JoinColumn(name = "CURRENCYCODE", referencedColumnName = "CURRENCYCODE", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Tgenecurrency tgenecurrency;
    @JoinColumn(name = "CHARGECURRENCYCODE", referencedColumnName = "CURRENCYCODE")
    @ManyToOne
    private Tgenecurrency chargecurrencycode;
    @JoinColumns({
        @JoinColumn(name = "MODULECODE", referencedColumnName = "MODULECODE", insertable = false, updatable = false),
        @JoinColumn(name = "PRODUCTCODE", referencedColumnName = "PRODUCTCODE", insertable = false, updatable = false),
        @JoinColumn(name = "SUBPRODUCTCODE", referencedColumnName = "SUBPRODUCTCODE", insertable = false, updatable = false)})
    @ManyToOne(optional = false)
    private Tgenesubproduct tgenesubproduct;

    public Tgenesubproductcharges() {
    }

    public Tgenesubproductcharges(TgenesubproductchargesPK tgenesubproductchargesPK) {
        this.tgenesubproductchargesPK = tgenesubproductchargesPK;
    }

    public Tgenesubproductcharges(TgenesubproductchargesPK tgenesubproductchargesPK, BigDecimal minamount) {
        this.tgenesubproductchargesPK = tgenesubproductchargesPK;
        this.minamount = minamount;
    }

    public Tgenesubproductcharges(String balancetype, String balancegroup, String modulecode, String productcode, String subproductcode, String statuscode, long companycode, String currencycode, short ratesequence) {
        this.tgenesubproductchargesPK = new TgenesubproductchargesPK(balancetype, balancegroup, modulecode, productcode, subproductcode, statuscode, companycode, currencycode, ratesequence);
    }

    public TgenesubproductchargesPK getTgenesubproductchargesPK() {
        return tgenesubproductchargesPK;
    }

    public void setTgenesubproductchargesPK(TgenesubproductchargesPK tgenesubproductchargesPK) {
        this.tgenesubproductchargesPK = tgenesubproductchargesPK;
    }

    public BigDecimal getRate() {
        return rate;
    }

    public void setRate(BigDecimal rate) {
        this.rate = rate;
    }

    public BigDecimal getPercent() {
        return percent;
    }

    public void setPercent(BigDecimal percent) {
        this.percent = percent;
    }

    public BigDecimal getMinvalue() {
        return minvalue;
    }

    public void setMinvalue(BigDecimal minvalue) {
        this.minvalue = minvalue;
    }

    public BigDecimal getMaxvalue() {
        return maxvalue;
    }

    public void setMaxvalue(BigDecimal maxvalue) {
        this.maxvalue = maxvalue;
    }

    public BigDecimal getMinamount() {
        return minamount;
    }

    public void setMinamount(BigDecimal minamount) {
        this.minamount = minamount;
    }

    public BigDecimal getMaxamount() {
        return maxamount;
    }

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

    public Tgenebalancetype getTgenebalancetype() {
        return tgenebalancetype;
    }

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

    public Tgenecompany getTgenecompany() {
        return tgenecompany;
    }

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

    public Tgenecurrency getTgenecurrency() {
        return tgenecurrency;
    }

    public void setTgenecurrency(Tgenecurrency tgenecurrency) {
        this.tgenecurrency = tgenecurrency;
    }

    public Tgenecurrency getChargecurrencycode() {
        return chargecurrencycode;
    }

    public void setChargecurrencycode(Tgenecurrency chargecurrencycode) {
        this.chargecurrencycode = chargecurrencycode;
    }

    public Tgenesubproduct getTgenesubproduct() {
        return tgenesubproduct;
    }

    public void setTgenesubproduct(Tgenesubproduct tgenesubproduct) {
        this.tgenesubproduct = tgenesubproduct;
    }

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

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