/*
 * 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.TGENECHARGESCHECKBOOK")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Tgenechargescheckbook.findAll", query = "SELECT t FROM Tgenechargescheckbook t"),
    @NamedQuery(name = "Tgenechargescheckbook.findByCheckbooktypecatalog", query = "SELECT t FROM Tgenechargescheckbook t WHERE t.tgenechargescheckbookPK.checkbooktypecatalog = :checkbooktypecatalog"),
    @NamedQuery(name = "Tgenechargescheckbook.findByCheckbooktypecatalogcode", query = "SELECT t FROM Tgenechargescheckbook t WHERE t.tgenechargescheckbookPK.checkbooktypecatalogcode = :checkbooktypecatalogcode"),
    @NamedQuery(name = "Tgenechargescheckbook.findByCompanycode", query = "SELECT t FROM Tgenechargescheckbook t WHERE t.tgenechargescheckbookPK.companycode = :companycode"),
    @NamedQuery(name = "Tgenechargescheckbook.findByCurrencycode", query = "SELECT t FROM Tgenechargescheckbook t WHERE t.tgenechargescheckbookPK.currencycode = :currencycode"),
    @NamedQuery(name = "Tgenechargescheckbook.findByValue", query = "SELECT t FROM Tgenechargescheckbook t WHERE t.value = :value")})
public class Tgenechargescheckbook implements Serializable {

    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected TgenechargescheckbookPK tgenechargescheckbookPK;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Column(name = "VALUE")
    private BigDecimal value;
    @JoinColumns({
        @JoinColumn(name = "CHECKBOOKTYPECATALOG", referencedColumnName = "CATALOG", insertable = false, updatable = false),
        @JoinColumn(name = "CHECKBOOKTYPECATALOGCODE", 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 Tgenechargescheckbook() {
    }

    public Tgenechargescheckbook(TgenechargescheckbookPK tgenechargescheckbookPK) {
        this.tgenechargescheckbookPK = tgenechargescheckbookPK;
    }

    public Tgenechargescheckbook(String checkbooktypecatalog, String checkbooktypecatalogcode, long companycode, String currencycode) {
        this.tgenechargescheckbookPK = new TgenechargescheckbookPK(checkbooktypecatalog, checkbooktypecatalogcode, companycode, currencycode);
    }

    public TgenechargescheckbookPK getTgenechargescheckbookPK() {
        return tgenechargescheckbookPK;
    }

    public void setTgenechargescheckbookPK(TgenechargescheckbookPK tgenechargescheckbookPK) {
        this.tgenechargescheckbookPK = tgenechargescheckbookPK;
    }

    public BigDecimal getValue() {
        return value;
    }

    public void setValue(BigDecimal value) {
        this.value = value;
    }

    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 += (tgenechargescheckbookPK != null ? tgenechargescheckbookPK.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 Tgenechargescheckbook)) {
            return false;
        }
        Tgenechargescheckbook other = (Tgenechargescheckbook) object;
        if ((this.tgenechargescheckbookPK == null && other.tgenechargescheckbookPK != null) || (this.tgenechargescheckbookPK != null && !this.tgenechargescheckbookPK.equals(other.tgenechargescheckbookPK))) {
            return false;
        }
        return true;
    }

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