/*
 * Copyright 2016 EPAM Systems
 *
 *
 * This file is part of EPAM Report Portal.
 * https://github.com/reportportal/commons-dao
 *
 * Report Portal is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * Report Portal is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Report Portal.  If not, see <http://www.gnu.org/licenses/>.
 */

package com.epam.ta.reportportal.database.entity.settings;

import com.google.common.base.MoreObjects;

import java.io.Serializable;

public class ServerEmailDetails implements Serializable {

    private String host;

    private int port = 25;

    private String protocol = "smtp";

    private Boolean authEnabled = false;

    private boolean starTlsEnabled;

    private boolean sslEnabled;

    private String username;

    private String password;

    private String from;

    private boolean debug;

    public ServerEmailDetails() {
    }

    public ServerEmailDetails(String host, int port, String protocol, Boolean authEnabled, boolean starTlsEnabled,
                              boolean sslEnabled, String username, String password, String from, boolean debug) {
        this.host = host;
        this.port = port;
        this.protocol = protocol;
        this.authEnabled = authEnabled;
        this.starTlsEnabled = starTlsEnabled;
        this.sslEnabled = sslEnabled;
        this.username = username;
        this.password = password;
        this.from = from;
        this.debug = debug;
    }

    public void setHost(String host) {
        this.host = host;
    }

    public String getHost() {
        return host;
    }

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

    public int getPort() {
        return port;
    }

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

    public String getProtocol() {
        return protocol;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getUsername() {
        return username;
    }

    public void setPassword(String pass) {
        this.password = pass;
    }

    public String getPassword() {
        return password;
    }

    public void setAuthEnabled(Boolean authEnabled) {
        this.authEnabled = authEnabled;
    }

    public boolean isStarTlsEnabled() {
        return starTlsEnabled;
    }

    public void setStarTlsEnabled(boolean starTlsEnabled) {
        this.starTlsEnabled = starTlsEnabled;
    }

    public Boolean getAuthEnabled() {
        return authEnabled;
    }

    public boolean isDebug() {
        return debug;
    }

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

    public boolean isSslEnabled() {
        return sslEnabled;
    }

    public void setSslEnabled(boolean sslEnabled) {
        this.sslEnabled = sslEnabled;
    }

    public String getFrom() {
        return from;
    }

    public void setFrom(String from) {
        this.from = from;
    }

    @Override
    public String toString() {
        return MoreObjects.toStringHelper(this).add("host", host).add("port", port).add("protocol", protocol)
                .add("authEnabled", authEnabled).add("starTlsEnabled", starTlsEnabled).add("sslEnabled", sslEnabled)
                .add("username", username).add("password", password).add("from", from).add("debug", debug).toString();
    }
}

@@ -1016,21 +1016,20 @@
 ate 
-i
+I
 nt
+eger
  port
- = 25
 ;%0A%0A 
@@ -1058,17 +1058,8 @@
 ocol
- = %22smtp%22
 ;%0A%0A 
@@ -1092,16 +1092,8 @@
 bled
- = false
 ;%0A%0A 
@@ -1095,33 +1095,33 @@
 d;%0A%0A    private 
-b
+B
 oolean starTlsEn
@@ -1136,25 +1136,25 @@
     private 
-b
+B
 oolean sslEn
@@ -1251,36 +1251,8 @@
 m;%0A%0A
-    private boolean debug;%0A%0A
     
@@ -1303,97 +1303,93 @@
 lic 
-ServerEmailDetails(String host, int port, String protocol, Boolean authEnabled, b
+void setPort(Integer port) %7B%0A        this.port = port;%0A    %7D%0A%0A    public B
 oolean 
-s
+getS
 tarT
@@ -1397,17 +1397,20 @@
 sEnabled
-,
+() %7B
 %0A       
@@ -1414,239 +1414,97 @@
     
-                      boolean sslEnabled, String username, String password, String from, boolean debug) %7B
+return starTlsEnabled;
 %0A    
+%7D%0A%0A
     
-this.host = host;%0A        this.port = port;%0A        this.protocol = protocol;%0A        this.authEnabled = auth
+public void setStarTlsEnabled(Boolean starTls
 Enabled
-;
+) %7B
 %0A   
@@ -1550,39 +1550,42 @@
 ed;%0A    
+%7D%0A%0A
     
-this.sslEnabled = s
+public Boolean getS
 slEnable
@@ -1581,25 +1581,28 @@
 etSslEnabled
-;
+() %7B
 %0A        thi
@@ -1602,120 +1602,122 @@
     
-this.username = username
+return sslEnabled
 ;%0A    
+%7D%0A%0A
     
-this.password = password;%0A        this.from = from;%0A        this.debug = debug
+public void setSslEnabled(Boolean sslEnabled) %7B%0A        this.sslEnabled = sslEnabled
 ;%0A  
@@ -2812,145 +2812,8 @@
  %7D%0A%0A
-    public boolean isDebug() %7B%0A        return debug;%0A    %7D%0A%0A    public void setDebug(boolean debug) %7B%0A        this.debug = debug;%0A    %7D%0A%0A
     
@@ -3468,28 +3468,8 @@
 om).
-add(%22debug%22, debug).
 toSt

update server email settings