/*
 * 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.CascadeType;
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.TARMLECTURA")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Tarmlectura.findAll", query = "SELECT t FROM Tarmlectura t"),
    @NamedQuery(name = "Tarmlectura.findByClectura", query = "SELECT t FROM Tarmlectura t WHERE t.clectura = :clectura"),
    @NamedQuery(name = "Tarmlectura.findByFecha", query = "SELECT t FROM Tarmlectura t WHERE t.fecha = :fecha"),
    @NamedQuery(name = "Tarmlectura.findByIdportal", query = "SELECT t FROM Tarmlectura t WHERE t.idportal = :idportal"),
    @NamedQuery(name = "Tarmlectura.findByDireccion", query = "SELECT t FROM Tarmlectura t WHERE t.direccion = :direccion")})
public class Tarmlectura implements Serializable {

    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "CLECTURA")
    private Long clectura;
    @Column(name = "FECHA")
    @Temporal(TemporalType.TIMESTAMP)
    private Date fecha;
    @Column(name = "IDPORTAL")
    private String idportal;
    @Column(name = "DIRECCION")
    private String direccion;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "tarmlectura")
    private Collection<Tarmlecturadetalle> tarmlecturadetalleCollection;
    @JoinColumns({
        @JoinColumn(name = "TIPOLECTURA", referencedColumnName = "CATALOG"),
        @JoinColumn(name = "TIPOLECTURACODE", referencedColumnName = "CATALOGCODE")})
    @ManyToOne
    private Tgenecatalogdetail tgenecatalogdetail;
    @JoinColumns({
        @JoinColumn(name = "COUNTRYCODE", referencedColumnName = "COUNTRYCODE"),
        @JoinColumn(name = "PROVINCECODE", referencedColumnName = "PROVINCECODE"),
        @JoinColumn(name = "CANTONCODE", referencedColumnName = "CANTONCODE"),
        @JoinColumn(name = "PARROQUIACODE", referencedColumnName = "PARROQUIACODE")})
    @ManyToOne
    private Tgeneparroquia tgeneparroquia;

    public Tarmlectura() {
    }

    public Tarmlectura(Long clectura) {
        this.clectura = clectura;
    }

    public Long getClectura() {
        return clectura;
    }

    public void setClectura(Long clectura) {
        this.clectura = clectura;
    }

    public Date getFecha() {
        return fecha;
    }

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

    public String getIdportal() {
        return idportal;
    }

    public void setIdportal(String idportal) {
        this.idportal = idportal;
    }

    public String getDireccion() {
        return direccion;
    }

    public void setDireccion(String direccion) {
        this.direccion = direccion;
    }

    @XmlTransient
    public Collection<Tarmlecturadetalle> getTarmlecturadetalleCollection() {
        return tarmlecturadetalleCollection;
    }

    public void setTarmlecturadetalleCollection(Collection<Tarmlecturadetalle> tarmlecturadetalleCollection) {
        this.tarmlecturadetalleCollection = tarmlecturadetalleCollection;
    }

    public Tgenecatalogdetail getTgenecatalogdetail() {
        return tgenecatalogdetail;
    }

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

    public Tgeneparroquia getTgeneparroquia() {
        return tgeneparroquia;
    }

    public void setTgeneparroquia(Tgeneparroquia tgeneparroquia) {
        this.tgeneparroquia = tgeneparroquia;
    }

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

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