using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace GreenTree.Nachtragsmanagement.Core.Configuration
{
    public class MailServerElement : ConfigurationElement
    {
        /// <summary>
        /// SMTP server which sends out the mails
        /// </summary>
        [ConfigurationProperty("smtpServer", DefaultValue = "localhost", IsRequired = true)]
        public string SmtpServer
        {
            get
            {
                return (string)this["smtpServer"];
            }
            set
            {
                this["smtpServer"] = value;
            }
        }

        /// <summary>
        /// Server port where SMTP is available
        /// </summary>
        [ConfigurationProperty("port", DefaultValue = 25, IsRequired = true)]
        public int Port
        {
            get
            {
                return (int)this["port"];
            }
            set
            {
                this["port"] = value;
            }
        }

        /// <summary>
        /// Username which will be authenticated against SMTP server
        /// </summary>
        [ConfigurationProperty("username", DefaultValue = "", IsRequired = false)]
        public string Username
        {
            get
            {
                return (string)this["username"];
            }
            set
            {
                this["username"] = value;
            }
        }

        /// <summary>
        /// Domain in which the users exists
        /// </summary>
        [ConfigurationProperty("domain", DefaultValue = "", IsRequired = false)]
        public string Domain
        {
            get
            {
                return (string)this["domain"];
            }
            set
            {
                this["domain"] = value;
            }
        }

        /// <summary>
        /// Password of the authenticated user
        /// </summary>
        [ConfigurationProperty("password", DefaultValue = "", IsRequired = false)]
        public string Password
        {
            get
            {
                return (string)this["password"];
            }
            set
            {
                this["password"] = value;
            }
        }

        /// <summary>
        /// Determines if the connection should use SSL/TLS
        /// </summary>
        [ConfigurationProperty("useSsl", DefaultValue = false, IsRequired = false)]
        public bool UseSsl
        {
            get
            {
                return (bool)this["useSsl"];
            }
            set
            {
                this["useSsl"] = value;
            }
        }
    }
}
