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

    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected TgenechargesPK tgenechargesPK;
    // @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 = "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;

    public Tgenecharges() {
    }

    public Tgenecharges(TgenechargesPK tgenechargesPK) {
        this.tgenechargesPK = tgenechargesPK;
    }

    public Tgenecharges(String balancetype, String balancegroup, String modulecode, String statuscode, long companycode, String currencycode, short ratesequence) {
        this.tgenechargesPK = new TgenechargesPK(balancetype, balancegroup, modulecode, statuscode, companycode, currencycode, ratesequence);
    }

    public TgenechargesPK getTgenechargesPK() {
        return tgenechargesPK;
    }

    public void setTgenechargesPK(TgenechargesPK tgenechargesPK) {
        this.tgenechargesPK = tgenechargesPK;
    }

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

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

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