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

namespace SystemX.Net.Comm.IIS_FTP
{ 
    public class ManagerInfoFTP
    {
        protected static double dDiffScanCheckFileTime = 60.0;   
        
        public sealed class ConnectFTPInformation
        {
            public bool UseFTPService { set; get; }

            public IPAddress InfoIPAddress { set; get; }

            public int InfoPort { set; get; }

            public string InfoUseUserAccount { set; get; }

            public string InfoUseUserPassword { set; get; }
        }

        protected ConnectFTPInformation UseInfo { set; get; }

        protected string LastestCommandStatusDescription { set; get; }
        protected FtpStatusCode LastestCommandStatusCode { set; get; }
        protected Exception LastestCommandException { set; get; }

        public virtual string GetLastestCommandStatusDescriptionText()
        {
            return string.Empty;
        }

        public virtual FtpStatusCode GetLastestCommandStatusCodeText()
        {
            return FtpStatusCode.Undefined;
        }

        public virtual string GetLastestExceptionText()
        {
            return string.Empty;
        }

        public virtual Exception GetLastestException()
        {
            return null;
        }

        public string LastestCommandDebugInformation()
        {
            string strMakeMessage = string.Format("{0}@{1}", LastestCommandStatusDescription, LastestCommandStatusCode.ToString());

            if (LastestCommandException != null)
                strMakeMessage += "@" + LastestCommandException.Message;

            return strMakeMessage;
        }

        public ManagerInfoFTP(bool bUseService, IPAddress SetIpAddress, int nSetPort, string strSetUserName, string strSetUserPassword)
        {
            UseInfo = new ConnectFTPInformation();

            UseInfo.UseFTPService = bUseService;

            UseInfo.InfoIPAddress = SetIpAddress;
            UseInfo.InfoPort = nSetPort;
            UseInfo.InfoUseUserAccount = strSetUserName;
            UseInfo.InfoUseUserPassword = strSetUserPassword;
        }

        public bool FTPConnState { set; get; }
    }
}
