/*
 * Copyright 2016 EPAM Systems
 * 
 * 
 * This file is part of EPAM Report Portal.
 * https://github.com/epam/ReportPortal
 * 
 * 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.ws.model.settings;

import java.io.Serializable;

import javax.validation.constraints.NotNull;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.annotation.JsonProperty;

/**
 * Configurable email setting for project object
 * 
 * @author Andrei_Ramanchuk
 */
@JsonInclude(Include.NON_NULL)
public class ServerEmailConfig implements Serializable {
	/**
	 * Generated SVUID
	 */
	private static final long serialVersionUID = 2573744596368345366L;

	@NotNull
	@JsonProperty(value = "host")
	private String host;

	@JsonProperty(value = "port")
	private int port = 25;

	@JsonProperty(value = "protocol")
	private String protocol = "smtp";

	@JsonProperty(value = "authEnabled")
	private Boolean authEnabled = false;

	@JsonProperty
	private Boolean startTlsEnabled = false;

	@JsonProperty(value = "username")
	private String username;

	@JsonProperty(value = "password")
	private String password;

	@JsonProperty(value = "debug")
	@JsonIgnore
	private boolean debug;

	public ServerEmailConfig() {
	}

	public ServerEmailConfig(String host, int port, String protocol, Boolean authEnabled, Boolean startTlsEnabled,
			String username, String password, boolean debug) {
		this.host = host;
		this.port = port;
		this.protocol = protocol;
		this.authEnabled = authEnabled;
		this.startTlsEnabled = startTlsEnabled;
		this.username = username;
		this.password = password;
		this.debug = debug;
	}

	/* Setters and getters */
	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 getStartTlsEnabled() {
		return startTlsEnabled;
	}

	public void setStartTlsEnabled(Boolean startTlsEnabled) {
		this.startTlsEnabled = startTlsEnabled;
	}

	public Boolean getAuthEnabled() {
		return authEnabled;
	}

	public boolean isDebug() {
		return debug;
	}

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

	@Override
	public String toString() {
		return "ServerEmailConfig [host=" + host + ", port=" + port + ", protocol=" + protocol + ", authEnabled=" + authEnabled
				+ ", username=" + username + ", debug=" + debug + "]";
	}
}

@@ -1694,25 +1694,25 @@
 ty%0A%09private 
-B
+b
 oolean start
@@ -1702,33 +1702,32 @@
 ate boolean star
-t
 TlsEnabled = fal
@@ -1716,32 +1716,24 @@
 arTlsEnabled
- = false
 ;%0A%0A%09@JsonPro
@@ -2038,17 +2038,17 @@
 nabled, 
-B
+b
 oolean s
@@ -2042,33 +2042,32 @@
 ed, boolean star
-t
 TlsEnabled,%0A%09%09%09S
@@ -2221,33 +2221,32 @@
 led;%0A%09%09this.star
-t
 TlsEnabled = sta
@@ -2238,33 +2238,32 @@
 lsEnabled = star
-t
 TlsEnabled;%0A%09%09th
@@ -3070,24 +3070,22 @@
 lic 
-B
+b
 oolean 
-get
+is
 Star
-t
 TlsE
@@ -3104,25 +3104,24 @@
 %09return star
-t
 TlsEnabled;%0A
@@ -3144,17 +3144,16 @@
  setStar
-t
 TlsEnabl
@@ -3151,25 +3151,25 @@
 rTlsEnabled(
-B
+b
 oolean start
@@ -3163,25 +3163,24 @@
 boolean star
-t
 TlsEnabled) 
@@ -3188,25 +3188,24 @@
 %0A%09%09this.star
-t
 TlsEnabled =
@@ -3209,17 +3209,16 @@
 d = star
-t
 TlsEnabl

update naming in server email config