/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package hu.nir.nmail.ejb.entity;

import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.NamedQueries;
import javax.persistence.Table;

/**
 *
 * @author attila
 */
@Entity
@Table(name = "smtp_settings")
@NamedQueries({})
public class SmtpSettings implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected SmtpSettingsPK smtpSettingsPK;
    @Column(name = "debug", nullable = false)
    private boolean debug;
    @Column(name = "port", nullable = false)
    private long port;
    @Column(name = "tls", nullable = false)
    private boolean tls;
    @Column(name = "smtp_password", nullable = false)
    private String smtpPassword;
    @Column(name = "protocol", nullable = false)
    private String protocol;
    @Column(name = "auth", nullable = false)
    private boolean auth;

    public SmtpSettings() {
    }

    public SmtpSettings(SmtpSettingsPK smtpSettingsPK) {
        this.smtpSettingsPK = smtpSettingsPK;
    }

    public SmtpSettings(SmtpSettingsPK smtpSettingsPK, boolean debug, long port, boolean tls, String smtpPassword, String protocol, boolean auth) {
        this.smtpSettingsPK = smtpSettingsPK;
        this.debug = debug;
        this.port = port;
        this.tls = tls;
        this.smtpPassword = smtpPassword;
        this.protocol = protocol;
        this.auth = auth;
    }

    public SmtpSettings(String host, String smtpUserName) {
        this.smtpSettingsPK = new SmtpSettingsPK(host, smtpUserName);
    }

    public SmtpSettingsPK getSmtpSettingsPK() {
        return smtpSettingsPK;
    }

    public void setSmtpSettingsPK(SmtpSettingsPK smtpSettingsPK) {
        this.smtpSettingsPK = smtpSettingsPK;
    }

    public boolean getDebug() {
        return debug;
    }

    public void setDebug(boolean debug) {
        this.debug = debug;
    }

    public long getPort() {
        return port;
    }

    public void setPort(long port) {
        this.port = port;
    }

    public boolean getTls() {
        return tls;
    }

    public void setTls(boolean tls) {
        this.tls = tls;
    }

    public String getSmtpPassword() {
        return smtpPassword;
    }

    public void setSmtpPassword(String smtpPassword) {
        this.smtpPassword = smtpPassword;
    }

    public String getProtocol() {
        return protocol;
    }

    public void setProtocol(String protocol) {
        this.protocol = protocol;
    }

    public boolean getAuth() {
        return auth;
    }

    public void setAuth(boolean auth) {
        this.auth = auth;
    }

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

    @Override
    public String toString() {
        return "hu.nir.nmail.ejb.entity.SmtpSettings[smtpSettingsPK=" + smtpSettingsPK + "]";
    }

}
