/*
 * 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.util.Collection;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinColumns;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author developer2
 */
@Entity
@Table(name="COMACO.TGENEACTIVITY")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Tgeneactivity.findAll", query = "SELECT t FROM Tgeneactivity t"),
    @NamedQuery(name = "Tgeneactivity.findByActivitycode", query = "SELECT t FROM Tgeneactivity t WHERE t.activitycode = :activitycode"),
    @NamedQuery(name = "Tgeneactivity.findByDescription", query = "SELECT t FROM Tgeneactivity t WHERE t.description = :description"),
    @NamedQuery(name = "Tgeneactivity.findByModifyuser", query = "SELECT t FROM Tgeneactivity t WHERE t.modifyuser = :modifyuser"),
    @NamedQuery(name = "Tgeneactivity.findByModifydate", query = "SELECT t FROM Tgeneactivity t WHERE t.modifydate = :modifydate")})
public class Tgeneactivity implements Serializable {

    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "ACTIVITYCODE")
    private String activitycode;
    @Column(name = "DESCRIPTION")
    private String description;
    @Column(name = "MODIFYUSER")
    private String modifyuser;
    @Column(name = "MODIFYDATE")
    @Temporal(TemporalType.TIMESTAMP)
    private Date modifydate;
    @OneToMany(mappedBy = "activitycode")
    private Collection<Tcustpersondetail> tcustpersondetailCollection;
    @JoinColumns({
        @JoinColumn(name = "SEGMENTTYPECATALOG", referencedColumnName = "CATALOG"),
        @JoinColumn(name = "SEGMENTTYPECATALOGCODE", referencedColumnName = "CATALOGCODE")})
    @ManyToOne(optional = false)
    private Tgenecatalogdetail tgenecatalogdetail;
    @JoinColumn(name = "CIIUCODE", referencedColumnName = "CIIUCODE")
    @ManyToOne
    private Tgeneciiu ciiucode;

    public Tgeneactivity() {
    }

    public Tgeneactivity(String activitycode) {
        this.activitycode = activitycode;
    }

    public String getActivitycode() {
        return activitycode;
    }

    public void setActivitycode(String activitycode) {
        this.activitycode = activitycode;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getModifyuser() {
        return modifyuser;
    }

    public void setModifyuser(String modifyuser) {
        this.modifyuser = modifyuser;
    }

    public Date getModifydate() {
        return modifydate;
    }

    public void setModifydate(Date modifydate) {
        this.modifydate = modifydate;
    }

    @XmlTransient
    public Collection<Tcustpersondetail> getTcustpersondetailCollection() {
        return tcustpersondetailCollection;
    }

    public void setTcustpersondetailCollection(Collection<Tcustpersondetail> tcustpersondetailCollection) {
        this.tcustpersondetailCollection = tcustpersondetailCollection;
    }

    public Tgenecatalogdetail getTgenecatalogdetail() {
        return tgenecatalogdetail;
    }

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

    public Tgeneciiu getCiiucode() {
        return ciiucode;
    }

    public void setCiiucode(Tgeneciiu ciiucode) {
        this.ciiucode = ciiucode;
    }

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

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