/*
 * 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.TCUSTPEOPLELOAN")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Tcustpeopleloan.findAll", query = "SELECT t FROM Tcustpeopleloan t"),
    @NamedQuery(name = "Tcustpeopleloan.findByPersoncode", query = "SELECT t FROM Tcustpeopleloan t WHERE t.tcustpeopleloanPK.personcode = :personcode"),
    @NamedQuery(name = "Tcustpeopleloan.findByDateto", query = "SELECT t FROM Tcustpeopleloan t WHERE t.tcustpeopleloanPK.dateto = :dateto"),
    @NamedQuery(name = "Tcustpeopleloan.findByLoansequence", query = "SELECT t FROM Tcustpeopleloan t WHERE t.tcustpeopleloanPK.loansequence = :loansequence"),
    @NamedQuery(name = "Tcustpeopleloan.findByDatefrom", query = "SELECT t FROM Tcustpeopleloan t WHERE t.datefrom = :datefrom"),
    @NamedQuery(name = "Tcustpeopleloan.findByRecordversion", query = "SELECT t FROM Tcustpeopleloan t WHERE t.recordversion = :recordversion"),
    @NamedQuery(name = "Tcustpeopleloan.findByBankname", query = "SELECT t FROM Tcustpeopleloan t WHERE t.bankname = :bankname"),
    @NamedQuery(name = "Tcustpeopleloan.findByOriginalamont", query = "SELECT t FROM Tcustpeopleloan t WHERE t.originalamont = :originalamont"),
    @NamedQuery(name = "Tcustpeopleloan.findByBalance", query = "SELECT t FROM Tcustpeopleloan t WHERE t.balance = :balance"),
    @NamedQuery(name = "Tcustpeopleloan.findByBalancedate", query = "SELECT t FROM Tcustpeopleloan t WHERE t.balancedate = :balancedate"),
    @NamedQuery(name = "Tcustpeopleloan.findByQuotaamount", query = "SELECT t FROM Tcustpeopleloan t WHERE t.quotaamount = :quotaamount"),
    @NamedQuery(name = "Tcustpeopleloan.findByIngressusercode", query = "SELECT t FROM Tcustpeopleloan t WHERE t.ingressusercode = :ingressusercode"),
    @NamedQuery(name = "Tcustpeopleloan.findByModifyusercode", query = "SELECT t FROM Tcustpeopleloan t WHERE t.modifyusercode = :modifyusercode")})
public class Tcustpeopleloan implements Serializable {

    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected TcustpeopleloanPK tcustpeopleloanPK;
    @Column(name = "DATEFROM")
    @Temporal(TemporalType.TIMESTAMP)
    private Date datefrom;
    @Column(name = "RECORDVERSION")
    private BigInteger recordversion;
    @Column(name = "BANKNAME")
    private String bankname;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Column(name = "ORIGINALAMONT")
    private BigDecimal originalamont;
    @Column(name = "BALANCE")
    private BigDecimal balance;
    @Column(name = "BALANCEDATE")
    @Temporal(TemporalType.TIMESTAMP)
    private Date balancedate;
    @Column(name = "QUOTAAMOUNT")
    private BigDecimal quotaamount;
    @Column(name = "INGRESSUSERCODE")
    private String ingressusercode;
    @Column(name = "MODIFYUSERCODE")
    private String modifyusercode;
    @JoinColumn(name = "BANKPERSONCODE", referencedColumnName = "PERSONCODE")
    @ManyToOne
    private Tcustperson bankpersoncode;
    @JoinColumn(name = "PERSONCODE", referencedColumnName = "PERSONCODE", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Tcustperson tcustperson;
    @JoinColumns({
        @JoinColumn(name = "CREDITRATINGCATALOG", referencedColumnName = "CATALOG"),
        @JoinColumn(name = "CREDITRATINGCATALOGCODE", referencedColumnName = "CATALOGCODE")})
    @ManyToOne
    private Tgenecatalogdetail tgenecatalogdetail;
    @JoinColumns({
        @JoinColumn(name = "CREDITTYPECLIENTCATALOG", referencedColumnName = "CATALOG"),
        @JoinColumn(name = "CREDITTYPECLIENTCATALOGCODE", referencedColumnName = "CATALOGCODE")})
    @ManyToOne
    private Tgenecatalogdetail tgenecatalogdetail1;
    @JoinColumns({
        @JoinColumn(name = "FREQUENCYCLIENTCATALOG", referencedColumnName = "CATALOG"),
        @JoinColumn(name = "FREQUENCYCLIENTCATALOGCODE", referencedColumnName = "CATALOGCODE")})
    @ManyToOne
    private Tgenecatalogdetail tgenecatalogdetail2;
    @JoinColumn(name = "CURRENCYCODE", referencedColumnName = "CURRENCYCODE")
    @ManyToOne
    private Tgenecurrency currencycode;

    public Tcustpeopleloan() {
    }

    public Tcustpeopleloan(TcustpeopleloanPK tcustpeopleloanPK) {
        this.tcustpeopleloanPK = tcustpeopleloanPK;
    }

    public Tcustpeopleloan(long personcode, Date dateto, short loansequence) {
        this.tcustpeopleloanPK = new TcustpeopleloanPK(personcode, dateto, loansequence);
    }

    public TcustpeopleloanPK getTcustpeopleloanPK() {
        return tcustpeopleloanPK;
    }

    public void setTcustpeopleloanPK(TcustpeopleloanPK tcustpeopleloanPK) {
        this.tcustpeopleloanPK = tcustpeopleloanPK;
    }

    public Date getDatefrom() {
        return datefrom;
    }

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

    public BigInteger getRecordversion() {
        return recordversion;
    }

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

    public String getBankname() {
        return bankname;
    }

    public void setBankname(String bankname) {
        this.bankname = bankname;
    }

    public BigDecimal getOriginalamont() {
        return originalamont;
    }

    public void setOriginalamont(BigDecimal originalamont) {
        this.originalamont = originalamont;
    }

    public BigDecimal getBalance() {
        return balance;
    }

    public void setBalance(BigDecimal balance) {
        this.balance = balance;
    }

    public Date getBalancedate() {
        return balancedate;
    }

    public void setBalancedate(Date balancedate) {
        this.balancedate = balancedate;
    }

    public BigDecimal getQuotaamount() {
        return quotaamount;
    }

    public void setQuotaamount(BigDecimal quotaamount) {
        this.quotaamount = quotaamount;
    }

    public String getIngressusercode() {
        return ingressusercode;
    }

    public void setIngressusercode(String ingressusercode) {
        this.ingressusercode = ingressusercode;
    }

    public String getModifyusercode() {
        return modifyusercode;
    }

    public void setModifyusercode(String modifyusercode) {
        this.modifyusercode = modifyusercode;
    }

    public Tcustperson getBankpersoncode() {
        return bankpersoncode;
    }

    public void setBankpersoncode(Tcustperson bankpersoncode) {
        this.bankpersoncode = bankpersoncode;
    }

    public Tcustperson getTcustperson() {
        return tcustperson;
    }

    public void setTcustperson(Tcustperson tcustperson) {
        this.tcustperson = tcustperson;
    }

    public Tgenecatalogdetail getTgenecatalogdetail() {
        return tgenecatalogdetail;
    }

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

    public Tgenecatalogdetail getTgenecatalogdetail1() {
        return tgenecatalogdetail1;
    }

    public void setTgenecatalogdetail1(Tgenecatalogdetail tgenecatalogdetail1) {
        this.tgenecatalogdetail1 = tgenecatalogdetail1;
    }

    public Tgenecatalogdetail getTgenecatalogdetail2() {
        return tgenecatalogdetail2;
    }

    public void setTgenecatalogdetail2(Tgenecatalogdetail tgenecatalogdetail2) {
        this.tgenecatalogdetail2 = tgenecatalogdetail2;
    }

    public Tgenecurrency getCurrencycode() {
        return currencycode;
    }

    public void setCurrencycode(Tgenecurrency currencycode) {
        this.currencycode = currencycode;
    }

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

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