using System;
using System.Collections.Generic;

namespace MOKA_Factory_Tools
{
    
    class StructList
    {
        public static string CheckServerConnectionUrl = "https://cn.uc.qhmoka.com/scbc-server";//检查网络是否通顺对应URL
    }

    public class LocalPath
    {
        public static string localpath { get; set; }= AppDomain.CurrentDomain.BaseDirectory;
    }


    public class MidList
    {
        public string message { get; set; }
        public string code { get; set; }
        public string factoryname { get; set; }
        public string factoryip { get; set; }
        public string factoryNum { get; set; }
        public string version { get; set; }
        public string projectid { get; set; }
        public string clienttype { get; set; }
        public string host { get; set; }
        public string quantity { get; set; }
        public string whiteType { get; set; }
        public RokuCustomer rokuCustomer { get; set; }
        public Dictionary <string,string> keytype { get; set; }
    }

    public class RokuCustomer
    {
        public string id { get; set; }
        public string ordernum { get; set; }
        public string brand { get; set; }
        public string region { get; set; }
        public string oemmodel { get; set; }
        public string supporturl { get; set; }
        public string supportphone { get; set; }
        public string productiondate { get; set; }
        public string remotetype { get; set; }
        public string updatetime { get; set; }
        public string createtime { get; set; }
        public string isdelete { get; set; }
    }

    public class WhiteBalanceInput
    {
        public string bid { get; set; }
        public string mac { get; set; }
    }
    public class WhiteBalanceList
    {
        public string message { get; set; }
        public string code { get; set; }
        public WhiteBalanceInfo whiteBalanceInfo { get; set; }
    }
    public class WhiteBalanceInfo
    {
        public string id { get; set; }
        public string ordernum { get; set; }
        public string hdmirgain { get; set; }
        public string hdmiggain { get; set; }
        public string hdmibgain { get; set; }
        public string nrgain { get; set; }
        public string nggain { get; set; }
        public string nbgain { get; set; }
        public string lrgain { get; set; }
        public string lggain { get; set; }
        public string lbgain { get; set; }
        public string updatetime { get; set; }
        public string createtime { get; set; }
        public string isdelete { get; set; }
        public string isExemption { get; set; }
    }

    public class MidAddress
    {
        public string host { get; set; }
        public string order { get; set; }
        public string number { get; set; }
        public string pid { get; set; }
        public string ctype { get; set; }
        public string version { get; set; }
        public string purl { get; set; }
        public string psize { get; set; }
        public string pmd5 { get; set; }
        public string status { get; set; }
        public string start_date { get; set; }
        public string finish_date { get; set; }
        public string des { get; set; }
        public string code { get; set; }

    }


    public class OrderInput
    {
        public string clientType { get; set; }
        public string version { get; set; }
        public string bid { get; set; }
        public string mac { get; set; }
    }

    public class DBKeysStringFormat
    {
        public string cikey { get; set; }
        public string esn { get; set; }
        public string hdcp { get; set; }
        public string widevine { get; set; }
        public string hdcp22 { get; set; }
        public string did { get; set; }
        public string mac { get; set; }
        //public string widi { get; set; }
        public string mgk { get; set; }
        public string attestation { get; set; }
    }

    public class FunctionSetting
    {
        public string TVCOM { get; set; }
        public string TVBaud { get; set; }
        public int TVParity { get; set; } = 0;      // 校验位默认为None
        public string ChannelList { get; set; }
        public bool WriteChannel { get; set; }
        public bool WriteOSD { get; set; }
        public string OSDList { get; set; }
        public bool WriteSHOP { get; set; }
        public string SHOPList { get; set; }
        public bool WriteWB { get; set; }
        public bool WBInit { get; set; }
        public string WBPath { get; set; }
        public string WBFileName { get; set; }
        public byte[] ChannelCode { get; set; }
        public byte[] OSDLCode { get; set; }
        public byte[] ShopLCode { get; set; }
        public byte[] NormalRGB { get; set; }
        public byte[] CoolRGB { get; set; }
        public byte[] WarmRGB { get; set; }
        public int EnterFactoryRetry { get; set; }
        /// <summary>
        /// 全部Key抄写成功后，且上报成功后等待多久控件可用;
        /// </summary>
        public int Wait_after_completion { get; set; }
        public int LocalDidSize { get; set; }
        public int LocalMacSize { get; set; }
        public int LocalHdcpSize { get; set; }
        public int LocalWidiSize { get; set; }
        public int LocalHdcp22Size { get; set; }
        public int LocalEsnSize { get; set; }
        public int LocalMGKSize { get; set; }
        public int LocalCiSize { get; set; }
        public int LocalWidevineSize { get; set; }
        public int LocalFairplaySize { get; set; }
        public int LocalECPSize { get; set; }
        public int LocalWifiMacSize { get; set; }
        public int LocalBTMacSize { get; set; }
        public int localACASKeySize { get; set; }
        public bool NoDoublewrite { get; set; }//Local DB模式下不允许扫描已经抄写过的SN
        public string BarcodeKeyword { get; set; }
        public int BarcodeLength { get; set; }
        public bool BarcodeLimit { get; set; }
        public bool BarcodeWrite { get; set; }
        public int SerailDelay { get; set; }
        public bool UsingLocalServer { get; set; }
        public Dictionary<string, string> CustomCMD { get; set; }
        /// <summary>
        /// 允许不用扫条码抄写(单击按钮);
        /// </summary>
        public bool AllowNoScanning { get; set; }
        public int ReportTimeOut { get; set; }
        /// <summary>
        /// 是否启用G客户防呆措施;
        /// </summary>
        public bool UsingGFoolProofing { get; set; } = false;
        /// <summary>
        /// G客户防呆抄写次数限制，默认2次;
        /// </summary>
        public int GFoolProofingCount { get; set; } = 2;

        /// <summary>
        /// 是否导出日本板卡的ACAS ID与SN号;
        /// </summary>
        public bool ExportSNACASID { get; set; } = false;

        /// <summary>
        /// 串口指令读超时值，单位毫秒;
        /// </summary>
        public int ReadTimeout { get; set; } = 3000;

        /// <summary>
        /// 串口完成一次指令的Write、Read后，下一条指令等待多久开始执行;
        /// 单位：毫秒
        /// </summary>
        public int NextCommandWaitTime { get; set; } = 100;

        /// <summary>
        /// G客户NTF功能是否开启;
        /// </summary>
        public bool NTF { get; set; } = false;

        /// <summary>
        /// 产线线体;
        /// </summary>
        public string Line { get; set; }

        /// <summary>
        /// 产线工站，抄写工具默认为DataBurning
        /// </summary>
        public readonly string Station = "DataBurning";

        #region 波兰工厂DHA解决方案;
        /// <summary>
        /// DHA抄写完后等待完成时间;
        /// </summary>
        public int CheckDHAWaitTime { get; set; } = 8000;
        /// <summary>
        /// 是否开启DHA功能,默认关闭;
        /// </summary>
        public bool DHA { get; set; } = false;
        #endregion

        #region 小米FireTV功能模块启用;
        /// <summary>
        /// 是否启用小米FireTV功能模块 ;
        /// </summary>
        public bool MITVEnable { get; set; } = false;

        public string MIKeyUrl { get; set; } = "http://smes-app-prod.tclking.com:9006/api/SMESCustomer/GetXMCard";
        public string MIKeyReportUrl { get; set; } = "http://smes-app-prod.tclking.com:9006/api/SMESCustomer/UploadXMDataControl";
        #endregion

        #region 离线EDID
        public bool edid_offline { get; set; } = false;
        public string edid_pid { get; set; } = "";
        public string edid_model_name { get; set; } = "";
        #endregion

        #region 串口重试机制
        public bool EnableRetry { get; set; } = false;
        public int RetryCount { get;set; } = 3;
        #endregion
        // 抄写结束时,是否触发离开工厂模式指令;
        public bool LeaveFactory { get; set; } = false;
        // 当SN连接2次抄写时提示,主要防止一个SN被扫描在2台机器上;
        public bool SNDoubleTips { get; set; } = false;
    }

    public enum KEY_FROM
    {
        FROM_IDM = 0,
        FROM_MES = 1,
    }

    public class KeyData
    {
        public KeyData(string n="") {
            name = n;
        }

        // 要抄写的Key的名称;
        public string name { get; set; }
        // 是否要抄写该Key;
        public bool enable { get; set; } = false;
        // 要抄写的Key数据;
        public string data { get; set; }
        // 要抄写的Key数据md5值;
        public string md5 { get;set; }
        // 抄写结果;
        public bool result { get; set; } = false; 
        // 抄写结果描述;
        public string msg { get; set; }
        // key的来源;
        public KEY_FROM keyfrom { get; set; } = KEY_FROM.FROM_IDM;
        // 要抄写的Key数据长度;
        public int Length
        {
            get { return data == null ? 0 : data.Length; }
        }

        /// <summary>
        /// KeyData kd; string data; data = kd;
        /// </summary>
        /// <param name="v"></param>
        public static implicit operator string(KeyData v)
        {
            return v.data;
        }
    }

    public class KeyInfo
    {
        public KeyData DID = new KeyData("deviceid");
        public KeyData Mac = new KeyData("mac");
        public KeyData HDCP = new KeyData("hdcp");
        public KeyData HDCP22 = new KeyData("hdcp2");
        public KeyData ESN = new KeyData("netfilx");
        //public KeyData WiDi = new KeyData();
        public KeyData Widevine = new KeyData("widevine");
        public KeyData CI_plus = new KeyData("ci");
        public KeyData Attestation = new KeyData("attention");
       // public KeyData AttestationMD5 = new KeyData();
        public KeyData MGK = new KeyData("mgk");
        public KeyData Fairplay = new KeyData("fairplay");
        public KeyData DSN = new KeyData("dsn");
        public KeyData WiFi_MAC = new KeyData("wifiMac");
        public KeyData BT_MAC = new KeyData("btMac");
        public KeyData LEK = new KeyData("lek");
        public KeyData PEK = new KeyData("pek");
        public KeyData Playready = new KeyData("playready");
        public KeyData Hashkey = new KeyData("hash");
        public KeyData ECP = new KeyData("ecp");
        public KeyData YouTube_KEY = new KeyData("youtube");
        public KeyData EDIDPid = new KeyData();
        public KeyData EDIDModelName = new KeyData();
        public KeyData ACASKey_Data = new KeyData("acas");
        //public KeyData ACASKey_Tool = new KeyData();
        //public KeyData ACASKey_DataMd5 = new KeyData();
        //public KeyData ACASKey_ToolMd5 = new KeyData();
        public KeyData DAK = new KeyData("dak");
        public KeyData FVP = new KeyData();
        #region Kayla所需数据;
        public KeyData _PSN = new KeyData();
        #endregion
    }

    public class FireTVKey
    {
        public bool LEK { get; set; }
        public bool PEK { get; set; }
        public bool Playready { get; set; }
        public bool Hashkey { get; set; }
    }

    public class FireTVDsnInput
    {
        public string ordernum { get; set; }
        public string fsn { get; set; }
        public string psn { get; set; }
        public string deviceCode { get; set; }
        public string mac { get; set; }
    }

    public class Config_ReadCheck
    {
        public bool PIDReadcheck { get; set; }
        public bool OSDReadcheck { get; set; }
        public bool SHOPReadcheck { get; set; }
        public bool DIDReadcheck { get; set; }
        public bool MacReadcheck { get; set; }
        public bool HDCPReadcheck { get; set; }
        public bool HDCP22Readcheck { get; set; }
        public bool ESNReadcheck { get; set; }
        public bool WidevineReadcheck { get; set; }
        public bool CI_plusReadcheck { get; set; }
        public bool AttestationReadcheck { get; set; }
        public bool MGKReadcheck { get; set; }
        public bool FairplayReadcheck { get; set; }
        public bool ECPReadcheck { get; set; }
        public bool WifiMacReadcheck { get; set; }
        public bool BTMacReadcheck { get; set; }
        public bool LEKReadcheck { get; set; }
        public bool PEKReadcheck { get; set; }
        public bool PlayreadyReadcheck { get; set; }
        public bool HashReadcheck { get; set; }
        public bool DSNReadcheck { get; set; }
        public bool YouTubeReadcheck { get; set; }
        public bool EDIDPIDReadcheck { get; set; }
        public bool EDIDModeNameReadcheck { get; set; }
        public bool ACASKeyReadcheck { get; set; }
        public bool ACASIDReadcheck { get; set; }
        public bool FVPReadcheck { get; set; }
        public bool DAKReadcheck { get; set; }
        public bool DolbyReadcheck { get; set; }
    }

    public class Config_WriteCheck
    {
        public bool DIDCheckcheck { get; set; }
        public bool MacCheckcheck { get; set; }
        public bool HDCPCheckcheck { get; set; }
        public bool HDCP22Checkcheck { get; set; }
        public bool ESNCheckcheck { get; set; }
        public bool WidevineCheckcheck { get; set; }
        public bool CI_plusCheckcheck { get; set; }
        public bool AttestationCheckcheck { get; set; }
        public bool MGKCheckcheck { get; set; }
        public bool FairplayCheckcheck { get; set; }
        public bool ECPCheckcheck { get; set; }
        public bool WifiMacCheckcheck { get; set; }
        public bool BTMacCheckcheck { get; set; }
        public bool LEKCheckcheck { get; set; }
        public bool PEKCheckcheck { get; set; }
        public bool PlayreadyCheckcheck { get; set; }
        public bool HashCheckcheck { get; set; }
        public bool DSNCheckcheck { get; set; }
        public bool YouTubeCheckcheck { get; set; }
        public bool ACASKeyCheckcheck { get; set; }
        public bool FVPCheckcheck { get; set; }
        public bool DAKCheckcheck { get; set; }
        public bool DolbyCheckcheck { get; set; }
    }

    public class Config_WriteDone
    {
        public bool PIDWrite_YesNo { get; set; }
        public int PIDWriteDelay { get; set; }
        public bool AutoWhiteBalance { get; set; }
        public bool ChannelWrite_YesNo { get; set; }
        public bool OSDWrite_YesNo { get; set; }
        public bool SHOPWrite_YesNo { get; set; }
        public bool ClientTypeCheck_YesNo { get; set; }
        public bool SoftwareVersionCheck_YesNo { get; set; }
        public bool EDIDPIDWrite_YesNo { get; set; }
        public bool EDIDModeNameWrite_YesNo { get; set; }
        public bool FVPWrite_YesNo { get; set; }
	    public bool DolbyWrite_YesNo { get;set; }
        #region getmessage接口对应需要在线获取的key类型;
        public bool DIDWrite_YesNo { get; set; }
        public bool MacWrite_YesNo { get; set; }
        public bool HDCPWrite_YesNo { get; set; }
        public bool HDCP22Write_YesNo { get; set; }
        public bool ESNWrite_YesNo { get; set; }        
        public bool WidevineWrite_YesNo { get; set; }
        public bool CI_plusWrite_YesNo { get; set; }
        public bool AttestationWrite_YesNo { get; set; }
        public bool MGKWrite_YesNo { get; set; }
        public bool FairplayWrite_YesNo { get; set; }
        public bool ECPWrite_YesNo { get; set; }
        public bool WifiMacWrite_YesNo { get; set; }
        public bool BTMacWrite_YesNo { get; set; }
        public bool LEKWrite_YesNo { get; set; }
        public bool PEKWrite_YesNo { get; set; }
        public bool PlayreadyWrite_YesNo { get; set; }
        public bool HashWrite_YesNo { get; set; }
        public bool DSNWrite_YesNo { get; set; }
        public bool YouTubeWrite_YesNo { get; set; }       
        public bool ACASKeyWrite_YesNo { get; set; }
        public bool DAKWrite_YesNo { get; set; }
        #endregion
    }

    public class ErrorInfo
    {
        public string reportType { get; set; }
        public string reportData { get; set; }
        public string version { get; set; }
        public string factory { get; set; }
        public string mac { get; set; }
        public string reportTime { get; set; }

    }

    public class UpgradeCheckInput
    {
        public string appid { get; set; }
        public string devicemodel { get; set; }
        public string dnum { get; set; }
        public string ver { get; set; }
        public string type { get; set; }
    }

    public class UpgradeMsgList
    {
        public string servertime { get; set; }
        public string callid { get; set; }
        public string state { get; set; }
        public string note { get; set; }
        public string language { get; set; }
        public UpgradeMsgList2 upgrade { get; set; }
        public string apiversion { get; set; }
    }

    public class UpgradeReportInput
    {
        public string appid { get; set; }
        public string devmodel { get; set; }
        public string dnum { get; set; }
        public string ver { get; set; }
        public string result { get; set; }
        public string type { get; set; }
    }

    public class UpgradeMsgList2
    {
        public string type { get; set; }
        public string appid { get; set; }
        public string apptype { get; set; }
        public string version { get; set; }
        public string verid { get; set; }
        public object md5 { get; set; }
        public string size { get; set; }
        public string minicon { get; set; }
        public object midicon { get; set; }
        public string fileurl { get; set; }
        public string increment { get; set; }
        public object appendver { get; set; }
        public string updatetime { get; set; }
    }

    public static class Serverurl
    {
        public static string Testurl = "http://test.scbc.qhmoka.com/scbc-server/clientType/getMessage.do";//测试用服务器
        public static string Officialurl = "https://cn.uc.qhmoka.com/scbc-server/clientType/getMessage.do";//生产用服务器
    }

    public static class UpgradeUrl
    {
        public static string Officialurl = "https://cn.ota.qhmoka.com/ota-services/upmp/upgradeIncrForTool";//生产用升级检查接口
        public static string Testurl = "https://test.uc.qhmoka.com/ota-services/upmp/upgradeIncrForTool";//测试用升级检查接口
    }

    public static class UpgradeReportUrl
    {
        public static string Officialurl = "https://cn.ota.qhmoka.com/ota-services/upmp/operateInterfaceForPC";//生产用升级上报接口
        //public static string Testurl = "https://test.uc.qhmoka.com/ota-services/upmp/operateInterfaceForPC";//测试用升级上报接口
    }

    public static class ErrorreportServerurl
    {
        public static string Testurl = "http://test.micro.server.qhmoka.com/report/reportToolsLog";//异常上报测试服务器
        public static string Officialurl = "https://ap.micro.server.qhmoka.com/report/reportToolsLog";//异常上报正式服务器
    }

    public static class GetWhiteBalanceInfoUrl
    {
        public static string Testurl = "http://test.scbc.qhmoka.com/scbc-server/clientType/getBalanceMessage.do";//获取订单白平衡配置测试接口
        public static string Officialurl = "https://cn.uc.qhmoka.com/scbc-server/clientType/getBalanceMessage.do";//获取订单白平衡配置正式接口
    }

    public static class FireTVDsnUrl
    {
        public static string Testurl = "http://test.scbc.qhmoka.com/scbc-server/dsn/";//获取FireTV DSN相关测试接口
        public static string Officialurl = "https://cn.uc.qhmoka.com/scbc-server/dsn/";//获取FireTV DSN相关正式接口
    }

    public static class Loginurl
    {
        public static string Testurl = "http://test.scbc.qhmoka.com/scbc-server/login.do";//测试用登录接口
        public static string Officialurl = "https://cn.uc.qhmoka.com/scbc-server/login.do";//生产用登录接口
    }

    public class LoginInput
    {
        public string account { get; set; }
        public string password { get; set; }
        public string mac { get; set; }
    }
    public class LoginOutput
    {
        public string msg { get; set; }
        public string code { get; set; }
        public string factoryname { get; set; }
        public string factorynum { get; set; }
    }

    public static class TestMode
    {
        // 默认为正式服务器;
        public static bool testMode = false;
        public static string MAC = CommonMethod.GetMacAddress();
        public static string loginUrl = Loginurl.Officialurl;
        public static string fireTVDsnUrl = FireTVDsnUrl.Officialurl;
        public static string getWhiteBalanceInfoUrl = GetWhiteBalanceInfoUrl.Officialurl;
        public static string errorreportServerurl = ErrorreportServerurl.Officialurl;
        public static string upgradeReportUrl = UpgradeReportUrl.Officialurl;
        public static string upgradeUrl = UpgradeUrl.Officialurl;
        public static string serverurl = Serverurl.Officialurl;

        public static void SetTestMode(bool simulation = false)
        {
            if (simulation)
            {// 模拟测试时使用测试服务器;
                loginUrl = Loginurl.Testurl;
                fireTVDsnUrl = FireTVDsnUrl.Testurl;
                getWhiteBalanceInfoUrl = GetWhiteBalanceInfoUrl.Testurl;
                errorreportServerurl = ErrorreportServerurl.Testurl;
                upgradeReportUrl = UpgradeReportUrl.Officialurl;
                upgradeUrl = UpgradeUrl.Testurl;
                serverurl = Serverurl.Testurl;
            }
            else
            {
                loginUrl = Loginurl.Officialurl;
                fireTVDsnUrl = FireTVDsnUrl.Officialurl;
                getWhiteBalanceInfoUrl = GetWhiteBalanceInfoUrl.Officialurl;
                errorreportServerurl = ErrorreportServerurl.Officialurl;
                upgradeReportUrl = UpgradeReportUrl.Officialurl;
                upgradeUrl = UpgradeUrl.Officialurl;
                serverurl = Serverurl.Officialurl;
            }
        }
    }

    #region G客户NTF统计功能
    public class MaInfo
    {
        public string ODF;
        public string BOM;
        public string SCREEN;
        public string SHIPPING;
        public string SIZE;
        public string Model;
        #region Kayla返回所需;
        public string project_name_I { get; set; } = "";
        public string build_I { get; set; } = "";
        public string build_config_I { get; set; } = "";
        public string diag_ver_I { get; set; } = "";
        public string image_name_ver_I { get; set; } = "";
        public string soc_type { get; set; } = "";
        public string speaker_vender { get; set; } = "";
        public string mic_vender { get; set; } = "";
        #endregion
    }
    #endregion

    #region 小米FireTVKey;
    public class MIKey
    {
        public string TVSN;
        public string Batchnum;
        public string UpdateUser;
        public string UpdateTime;
        public string FWVersion;
        public string Model;
        public string IsPrint;
        public string FWVersion_2;
        public string OPName;
        public string TVMN;
        public string EAN;
        public string SKU;
        public string DeviceID;
        public string OPSN;
        // 实际只抄写以下4项;
        public string EthernetMac;        
        public string BTMac;
        public string WIFIMAC;
        public string DSN;
        // 内置值;
        public string _PSN;
        public int _HDCP14;
        public int _HDCP22;
    }

    public class ReportMIKey
    {
        public string DSN { set; get; } = "";
        public string TVSN { set; get; } = "";
        public string TVMN { set; get; } = "";
        public string ChipSN { set; get; } = "";
        public string ChipMN { set; get; } = "";
        public string EthernetMAC { set; get; } = "";
        public string BTMAC { set; get; } = "";
        public string WIFIMAC { set; get; } = "";
        public string HDCP14 { set; get; } = "";
        public string HDCP22 { set; get; } = "";
    }
#endregion
}
