/*
 * 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 java.util.Date;
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.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author developer2
 */
@Entity
@Table(name="COMACO.TGENECURRENCYRATEGROUP")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Tgenecurrencyrategroup.findAll", query = "SELECT t FROM Tgenecurrencyrategroup t"),
    @NamedQuery(name = "Tgenecurrencyrategroup.findByCurrencyratecatalog", query = "SELECT t FROM Tgenecurrencyrategroup t WHERE t.tgenecurrencyrategroupPK.currencyratecatalog = :currencyratecatalog"),
    @NamedQuery(name = "Tgenecurrencyrategroup.findByCurrencyratecatalogcode", query = "SELECT t FROM Tgenecurrencyrategroup t WHERE t.tgenecurrencyrategroupPK.currencyratecatalogcode = :currencyratecatalogcode"),
    @NamedQuery(name = "Tgenecurrencyrategroup.findByCurrencycode", query = "SELECT t FROM Tgenecurrencyrategroup t WHERE t.tgenecurrencyrategroupPK.currencycode = :currencycode"),
    @NamedQuery(name = "Tgenecurrencyrategroup.findByDateto", query = "SELECT t FROM Tgenecurrencyrategroup t WHERE t.tgenecurrencyrategroupPK.dateto = :dateto"),
    @NamedQuery(name = "Tgenecurrencyrategroup.findByRecordversion", query = "SELECT t FROM Tgenecurrencyrategroup t WHERE t.recordversion = :recordversion"),
    @NamedQuery(name = "Tgenecurrencyrategroup.findByDatefrom", query = "SELECT t FROM Tgenecurrencyrategroup t WHERE t.datefrom = :datefrom"),
    @NamedQuery(name = "Tgenecurrencyrategroup.findByBuyrate", query = "SELECT t FROM Tgenecurrencyrategroup t WHERE t.buyrate = :buyrate"),
    @NamedQuery(name = "Tgenecurrencyrategroup.findBySellrate", query = "SELECT t FROM Tgenecurrencyrategroup t WHERE t.sellrate = :sellrate")})
public class Tgenecurrencyrategroup implements Serializable {

    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected TgenecurrencyrategroupPK tgenecurrencyrategroupPK;
    @Column(name = "RECORDVERSION")
    private BigInteger recordversion;
    @Column(name = "DATEFROM")
    @Temporal(TemporalType.TIMESTAMP)
    private Date datefrom;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Column(name = "BUYRATE")
    private BigDecimal buyrate;
    @Column(name = "SELLRATE")
    private BigDecimal sellrate;
    @JoinColumns({
        @JoinColumn(name = "CURRENCYRATECATALOG", referencedColumnName = "CATALOG", insertable = false, updatable = false),
        @JoinColumn(name = "CURRENCYRATECATALOGCODE", referencedColumnName = "CATALOGCODE", insertable = false, updatable = false)})
    @ManyToOne(optional = false)
    private Tgenecatalogdetail tgenecatalogdetail;
    @JoinColumn(name = "CURRENCYCODE", referencedColumnName = "CURRENCYCODE", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Tgenecurrency tgenecurrency;

    public Tgenecurrencyrategroup() {
    }

    public Tgenecurrencyrategroup(TgenecurrencyrategroupPK tgenecurrencyrategroupPK) {
        this.tgenecurrencyrategroupPK = tgenecurrencyrategroupPK;
    }

    public Tgenecurrencyrategroup(String currencyratecatalog, String currencyratecatalogcode, String currencycode, Date dateto) {
        this.tgenecurrencyrategroupPK = new TgenecurrencyrategroupPK(currencyratecatalog, currencyratecatalogcode, currencycode, dateto);
    }

    public TgenecurrencyrategroupPK getTgenecurrencyrategroupPK() {
        return tgenecurrencyrategroupPK;
    }

    public void setTgenecurrencyrategroupPK(TgenecurrencyrategroupPK tgenecurrencyrategroupPK) {
        this.tgenecurrencyrategroupPK = tgenecurrencyrategroupPK;
    }

    public BigInteger getRecordversion() {
        return recordversion;
    }

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

    public Date getDatefrom() {
        return datefrom;
    }

    public void setDatefrom(Date datefrom) {
        this.datefrom = datefrom;
    }

    public BigDecimal getBuyrate() {
        return buyrate;
    }

    public void setBuyrate(BigDecimal buyrate) {
        this.buyrate = buyrate;
    }

    public BigDecimal getSellrate() {
        return sellrate;
    }

    public void setSellrate(BigDecimal sellrate) {
        this.sellrate = sellrate;
    }

    public Tgenecatalogdetail getTgenecatalogdetail() {
        return tgenecatalogdetail;
    }

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

    public Tgenecurrency getTgenecurrency() {
        return tgenecurrency;
    }

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

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

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