/*
 * 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 java.math.BigInteger;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.NamedQueries;
import javax.persistence.OneToOne;
import javax.persistence.Table;

/**
 *
 * @author attila
 */
@Entity
@Table(name = "user_setting")
@NamedQueries({})
public class UserSetting implements Serializable {
    private static final long serialVersionUID = 1L;
    @Column(name = "bounce_address")
    private String bounceAddress;
    @Column(name = "bounced_delivered", nullable = false)
    private boolean bouncedDelivered;
    @Column(name = "default_sender_address")
    private String defaultSenderAddress;
    @Column(name = "default_sender_name")
    private String defaultSenderName;
    @Column(name = "message_limit")
    private BigInteger messageLimit;
    @Column(name = "time_limit")
    private BigInteger timeLimit;
    @Id
    @Column(name = "user_id", nullable = false)
    private Long userId;
    //@JoinColumn(name = "user_id", referencedColumnName = "user_id", insertable = false, updatable = false, nullable= false)
    //@OneToOne
    //private NmailUser nmailUser;

    public UserSetting() {
    }

    public UserSetting(Long userId) {
        this.userId = userId;
    }

    public UserSetting(Long userId, boolean bouncedDelivered) {
        this.userId = userId;
        this.bouncedDelivered = bouncedDelivered;
    }

    public String getBounceAddress() {
        return bounceAddress;
    }

    public void setBounceAddress(String bounceAddress) {
        this.bounceAddress = bounceAddress;
    }

    public boolean getBouncedDelivered() {
        return bouncedDelivered;
    }

    public void setBouncedDelivered(boolean bouncedDelivered) {
        this.bouncedDelivered = bouncedDelivered;
    }

    public String getDefaultSenderAddress() {
        return defaultSenderAddress;
    }

    public void setDefaultSenderAddress(String defaultSenderAddress) {
        this.defaultSenderAddress = defaultSenderAddress;
    }

    public String getDefaultSenderName() {
        return defaultSenderName;
    }

    public void setDefaultSenderName(String defaultSenderName) {
        this.defaultSenderName = defaultSenderName;
    }

    public Long getUserId() {
        return userId;
    }

    public void setUserId(Long userId) {
        this.userId = userId;
    }

    public BigInteger getMessageLimit() {
        return messageLimit;
    }

    public void setMessageLimit(BigInteger messageLimit) {
        this.messageLimit = messageLimit;
    }

    public BigInteger getTimeLimit() {
        return timeLimit;
    }

    public void setTimeLimit(BigInteger timeLimit) {
        this.timeLimit = timeLimit;
    }

    /*public NmailUser getNmailUser() {
        return nmailUser;
    }

    public void setNmailUser(NmailUser nmailUser) {
        this.nmailUser = nmailUser;
    }*/

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

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

}
