/*
 * 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.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.TGENECHARGESGROUP")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Tgenechargesgroup.findAll", query = "SELECT t FROM Tgenechargesgroup t"),
    @NamedQuery(name = "Tgenechargesgroup.findByChargecatalog", query = "SELECT t FROM Tgenechargesgroup t WHERE t.tgenechargesgroupPK.chargecatalog = :chargecatalog"),
    @NamedQuery(name = "Tgenechargesgroup.findByChargecatalogcode", query = "SELECT t FROM Tgenechargesgroup t WHERE t.tgenechargesgroupPK.chargecatalogcode = :chargecatalogcode"),
    @NamedQuery(name = "Tgenechargesgroup.findByBalancetype", query = "SELECT t FROM Tgenechargesgroup t WHERE t.tgenechargesgroupPK.balancetype = :balancetype"),
    @NamedQuery(name = "Tgenechargesgroup.findByBalancegroup", query = "SELECT t FROM Tgenechargesgroup t WHERE t.tgenechargesgroupPK.balancegroup = :balancegroup"),
    @NamedQuery(name = "Tgenechargesgroup.findByModulecode", query = "SELECT t FROM Tgenechargesgroup t WHERE t.tgenechargesgroupPK.modulecode = :modulecode"),
    @NamedQuery(name = "Tgenechargesgroup.findByStatuscode", query = "SELECT t FROM Tgenechargesgroup t WHERE t.tgenechargesgroupPK.statuscode = :statuscode"),
    @NamedQuery(name = "Tgenechargesgroup.findByCompanycode", query = "SELECT t FROM Tgenechargesgroup t WHERE t.tgenechargesgroupPK.companycode = :companycode"),
    @NamedQuery(name = "Tgenechargesgroup.findByCurrencycode", query = "SELECT t FROM Tgenechargesgroup t WHERE t.tgenechargesgroupPK.currencycode = :currencycode"),
    @NamedQuery(name = "Tgenechargesgroup.findByRate", query = "SELECT t FROM Tgenechargesgroup t WHERE t.rate = :rate"),
    @NamedQuery(name = "Tgenechargesgroup.findByPercent", query = "SELECT t FROM Tgenechargesgroup t WHERE t.percent = :percent"),
    @NamedQuery(name = "Tgenechargesgroup.findByMinvalue", query = "SELECT t FROM Tgenechargesgroup t WHERE t.minvalue = :minvalue"),
    @NamedQuery(name = "Tgenechargesgroup.findByMaxvalue", query = "SELECT t FROM Tgenechargesgroup t WHERE t.maxvalue = :maxvalue"),
    @NamedQuery(name = "Tgenechargesgroup.findByMinamount", query = "SELECT t FROM Tgenechargesgroup t WHERE t.tgenechargesgroupPK.minamount = :minamount"),
    @NamedQuery(name = "Tgenechargesgroup.findByMaxamount", query = "SELECT t FROM Tgenechargesgroup t WHERE t.maxamount = :maxamount")})
public class Tgenechargesgroup implements Serializable {

    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected TgenechargesgroupPK tgenechargesgroupPK;
    // @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;
    @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;
    @JoinColumns({
        @JoinColumn(name = "CHARGECATALOG", referencedColumnName = "CATALOG", insertable = false, updatable = false),
        @JoinColumn(name = "CHARGECATALOGCODE", 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;
    @JoinColumn(name = "CURRENCYCODE", referencedColumnName = "CURRENCYCODE", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Tgenecurrency tgenecurrency;
    @JoinColumn(name = "CHARGECURRENCYCODE", referencedColumnName = "CURRENCYCODE")
    @ManyToOne
    private Tgenecurrency chargecurrencycode;

    public Tgenechargesgroup() {
    }

    public Tgenechargesgroup(TgenechargesgroupPK tgenechargesgroupPK) {
        this.tgenechargesgroupPK = tgenechargesgroupPK;
    }

    public Tgenechargesgroup(String chargecatalog, String chargecatalogcode, String balancetype, String balancegroup, String modulecode, String statuscode, long companycode, String currencycode, BigDecimal minamount) {
        this.tgenechargesgroupPK = new TgenechargesgroupPK(chargecatalog, chargecatalogcode, balancetype, balancegroup, modulecode, statuscode, companycode, currencycode, minamount);
    }

    public TgenechargesgroupPK getTgenechargesgroupPK() {
        return tgenechargesgroupPK;
    }

    public void setTgenechargesgroupPK(TgenechargesgroupPK tgenechargesgroupPK) {
        this.tgenechargesgroupPK = tgenechargesgroupPK;
    }

    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 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 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;
    }

    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;
    }

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

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