/*
 * 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.BigInteger;
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.TARMMOVIMIENTOARMAS")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Tarmmovimientoarmas.findAll", query = "SELECT t FROM Tarmmovimientoarmas t"),
    @NamedQuery(name = "Tarmmovimientoarmas.findByCmovimiento", query = "SELECT t FROM Tarmmovimientoarmas t WHERE t.cmovimiento = :cmovimiento"),
    @NamedQuery(name = "Tarmmovimientoarmas.findByFecha", query = "SELECT t FROM Tarmmovimientoarmas t WHERE t.fecha = :fecha"),
    @NamedQuery(name = "Tarmmovimientoarmas.findByRecordversion", query = "SELECT t FROM Tarmmovimientoarmas t WHERE t.recordversion = :recordversion"),
    @NamedQuery(name = "Tarmmovimientoarmas.findByFactura", query = "SELECT t FROM Tarmmovimientoarmas t WHERE t.factura = :factura"),
    @NamedQuery(name = "Tarmmovimientoarmas.findByNoregistro", query = "SELECT t FROM Tarmmovimientoarmas t WHERE t.noregistro = :noregistro"),
    @NamedQuery(name = "Tarmmovimientoarmas.findByJustificacion", query = "SELECT t FROM Tarmmovimientoarmas t WHERE t.justificacion = :justificacion")})
public class Tarmmovimientoarmas implements Serializable {

    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "CMOVIMIENTO")
    private String cmovimiento;
    @Column(name = "FECHA")
    @Temporal(TemporalType.TIMESTAMP)
    private Date fecha;
    @Column(name = "RECORDVERSION")
    private BigInteger recordversion;
    @Column(name = "FACTURA")
    private String factura;
    @Column(name = "NOREGISTRO")
    private String noregistro;
    @Column(name = "JUSTIFICACION")
    private String justificacion;
    @JoinColumn(name = "CARMA", referencedColumnName = "CARMA")
    @ManyToOne
    private Tarmarmas carma;
    @JoinColumn(name = "PERSONCODECOMPRADOR", referencedColumnName = "PERSONCODE")
    @ManyToOne
    private Tcustperson personcodecomprador;
    @JoinColumn(name = "PERSONCODEVENDEDOR", referencedColumnName = "PERSONCODE")
    @ManyToOne
    private Tcustperson personcodevendedor;
    @JoinColumns({
        @JoinColumn(name = "TIPOMOVIMIENTO", referencedColumnName = "CATALOG"),
        @JoinColumn(name = "TIPOMOVIMIENTOCODIGO", referencedColumnName = "CATALOGCODE")})
    @ManyToOne
    private Tgenecatalogdetail tgenecatalogdetail;
    @OneToMany(mappedBy = "cmovimiento")
    private Collection<Tarmtotalpersona> tarmtotalpersonaCollection;

    public Tarmmovimientoarmas() {
    }

    public Tarmmovimientoarmas(String cmovimiento) {
        this.cmovimiento = cmovimiento;
    }

    public String getCmovimiento() {
        return cmovimiento;
    }

    public void setCmovimiento(String cmovimiento) {
        this.cmovimiento = cmovimiento;
    }

    public Date getFecha() {
        return fecha;
    }

    public void setFecha(Date fecha) {
        this.fecha = fecha;
    }

    public BigInteger getRecordversion() {
        return recordversion;
    }

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

    public String getFactura() {
        return factura;
    }

    public void setFactura(String factura) {
        this.factura = factura;
    }

    public String getNoregistro() {
        return noregistro;
    }

    public void setNoregistro(String noregistro) {
        this.noregistro = noregistro;
    }

    public String getJustificacion() {
        return justificacion;
    }

    public void setJustificacion(String justificacion) {
        this.justificacion = justificacion;
    }

    public Tarmarmas getCarma() {
        return carma;
    }

    public void setCarma(Tarmarmas carma) {
        this.carma = carma;
    }

    public Tcustperson getPersoncodecomprador() {
        return personcodecomprador;
    }

    public void setPersoncodecomprador(Tcustperson personcodecomprador) {
        this.personcodecomprador = personcodecomprador;
    }

    public Tcustperson getPersoncodevendedor() {
        return personcodevendedor;
    }

    public void setPersoncodevendedor(Tcustperson personcodevendedor) {
        this.personcodevendedor = personcodevendedor;
    }

    public Tgenecatalogdetail getTgenecatalogdetail() {
        return tgenecatalogdetail;
    }

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

    @XmlTransient
    public Collection<Tarmtotalpersona> getTarmtotalpersonaCollection() {
        return tarmtotalpersonaCollection;
    }

    public void setTarmtotalpersonaCollection(Collection<Tarmtotalpersona> tarmtotalpersonaCollection) {
        this.tarmtotalpersonaCollection = tarmtotalpersonaCollection;
    }

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

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