using drsPwEnc;
using Newtonsoft.Json;
using Pilz.Cryptography;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Pilz.Updating.Administration
{
    public class UpdateServerConfig
    {
        public bool UseProxyForWebDAV { get; set; } = false;
        public string ServerAdress { get; set; }
        public string PublicPackageBaseURL { get; set; }
        public string UpdateInfoFilename { get; set; }
        public string Username { get; set; }

        [JsonProperty("Password")]
        private string PasswordOld
        {
            set
            {
                if (string.IsNullOrEmpty(value))
                    Password = string.Empty;
                else
                    Password = new drsPwEnc.drsPwEnc().DecryptData(value);
            }
        }

        [JsonProperty("Password2")]
        public SecureString Password { get; set; }
    }
}
