using irisHelper;
using System;

namespace irisMemory
{
    public class AuthConfig
    {
        bool hasPrintAuthority;
        bool hasOpenDoorAuthority;
        bool hasTempDtAuthority;
        bool hasWorkAuthority;
        PrintDt printDt;
        DoorDt doorDt;
        TempDt tempDt;

        public bool HasPrintAuthority
        {
            get
            {
                return hasPrintAuthority;
            }

            set
            {
                hasPrintAuthority = value;
            }
        }

        public bool HasOpenDoorAuthority
        {
            get
            {
                return hasOpenDoorAuthority;
            }

            set
            {
                hasOpenDoorAuthority = value;
            }
        }

        public PrintDt PrintDt
        {
            get
            {
                return printDt;
            }

            set
            {
                printDt = value;
            }
        }

        public DoorDt DoorDt
        {
            get
            {
                return doorDt;
            }

            set
            {
                doorDt = value;
            }
        }

        public bool HasTempDtAuthority
        {
            get
            {
                return hasTempDtAuthority;
            }

            set
            {
                hasTempDtAuthority = value;
            }
        }

        public TempDt TempDt
        {
            get
            {
                return tempDt;
            }

            set
            {
                tempDt = value;
            }
        }

        public bool HasWorkAuthority
        {
            get
            {
                return hasWorkAuthority;
            }

            set
            {
                hasWorkAuthority = value;
            }
        }

        public AuthConfig()
        {
            string doorAu = ConfigHelper.GetAppConfig("doorSystemEnable");
            string printAu = ConfigHelper.GetAppConfig("printEnable");
            string tempAu = ConfigHelper.GetAppConfig("tempEnable");
            string workAu = ConfigHelper.GetAppConfig("workEnable");

            HasPrintAuthority = printAu == "true" ? true : false;
            HasOpenDoorAuthority = doorAu == "true" ? true : false;
            HasTempDtAuthority = tempAu == "true" ? true : false;
            HasWorkAuthority = workAu == "true" ? true : false;

            PrintDt = new PrintDt();
            DoorDt = new DoorDt();
            TempDt = new TempDt();
        }
    }

    public class PrintDt {
        string deviceSN;
        string destIp;
        string destPort;
        
        public PrintDt() {
            DestIp = ConfigHelper.GetAppConfig("destIp");
            DestPort = ConfigHelper.GetAppConfig("destPort");
            DeviceSN = ConfigHelper.GetAppConfig("deviceSN");
        }

        public string DeviceSN
        {
            get
            {
                return deviceSN;
            }

            set
            {
                deviceSN = value;
            }
        }

        public string DestIp
        {
            get
            {
                return destIp;
            }

            set
            {
                destIp = value;
            }
        }

        public string DestPort
        {
            get
            {
                return destPort;
            }

            set
            {
                destPort = value;
            }
        }
    }

    public class DoorDt
    {
        bool needPermisson;
        //string devCode;
        //string doorCode;
        //string inoutType;
        string serialPort;
        string sleepTime;
        bool checkTemp;

        public bool NeedPermisson
        {
            get
            {
                return needPermisson;
            }

            set
            {
                needPermisson = value;
            }
        }

        public string SerialPort
        {
            get
            {
                return serialPort;
            }

            set
            {
                serialPort = value;
            }
        }

        public string SleepTime
        {
            get
            {
                return sleepTime;
            }

            set
            {
                sleepTime = value;
            }
        }

        public bool CheckTemp
        {
            get
            {
                return checkTemp;
            }

            set
            {
                checkTemp = value;
            }
        }
        
        /*
public string DevCode
{
   get
   {
       return devCode;
   }

   set
   {
       devCode = value;
   }
}

public string DoorCode
{
   get
   {
       return doorCode;
   }

   set
   {
       doorCode = value;
   }
}

public string InoutType
{
   get
   {
       return inoutType;
   }

   set
   {
       inoutType = value;
   }
}
*/

        public DoorDt()
        {
            string perAu = ConfigHelper.GetAppConfig("needPermisson");

            NeedPermisson = perAu == "true" ? true : false;

            SerialPort = ConfigHelper.GetAppConfig("serialPort");
            SleepTime = ConfigHelper.GetAppConfig("sleepTime");

            string checkTemp = ConfigHelper.GetAppConfig("checkTemp");
            CheckTemp = checkTemp == "true" ? true : false;
            //DevCode = "";
            //DoorCode = "";
            //InoutType = "";
        }
    }

    public class TempDt
    {
        float correction;
        float paramRegion11;
        float paramRegion12;
        float paramRegion0;
        float separate0;
        float separate1;
        float separate2;
        float separate3;
        float paramRegion21;
        float paramRegion22;
        float paramRegion31;
        float paramRegion32;
        float paramHigh;
        float tnor;
        float tabnor;

        public float Correction
        {
            get
            {
                return correction;
            }

            set
            {
                correction = value;
            }
        }

        public float ParamRegion11
        {
            get
            {
                return paramRegion11;
            }

            set
            {
                paramRegion11 = value;
            }
        }

        public float ParamRegion12
        {
            get
            {
                return paramRegion12;
            }

            set
            {
                paramRegion12 = value;
            }
        }

        public float ParamRegion0
        {
            get
            {
                return paramRegion0;
            }

            set
            {
                paramRegion0 = value;
            }
        }

        public float Separate0
        {
            get
            {
                return separate0;
            }

            set
            {
                separate0 = value;
            }
        }

        public float Separate1
        {
            get
            {
                return separate1;
            }

            set
            {
                separate1 = value;
            }
        }

        public float Separate2
        {
            get
            {
                return separate2;
            }

            set
            {
                separate2 = value;
            }
        }

        public float Separate3
        {
            get
            {
                return separate3;
            }

            set
            {
                separate3 = value;
            }
        }

        public float ParamRegion21
        {
            get
            {
                return paramRegion21;
            }

            set
            {
                paramRegion21 = value;
            }
        }

        public float ParamRegion22
        {
            get
            {
                return paramRegion22;
            }

            set
            {
                paramRegion22 = value;
            }
        }

        public float ParamRegion31
        {
            get
            {
                return paramRegion31;
            }

            set
            {
                paramRegion31 = value;
            }
        }

        public float ParamRegion32
        {
            get
            {
                return paramRegion32;
            }

            set
            {
                paramRegion32 = value;
            }
        }

        public float ParamHigh
        {
            get
            {
                return paramHigh;
            }

            set
            {
                paramHigh = value;
            }
        }

        public float Tnor
        {
            get
            {
                return tnor;
            }

            set
            {
                tnor = value;
            }
        }

        public float Tabnor
        {
            get
            {
                return tabnor;
            }

            set
            {
                tabnor = value;
            }
        }

        public TempDt()
        {
            Correction = (float)Convert.ToDouble(ConfigHelper.GetAppConfig("correction"));

            ParamRegion0 = (float)Convert.ToDouble(ConfigHelper.GetAppConfig("paramRegion0"));
            ParamRegion11 = (float)Convert.ToDouble(ConfigHelper.GetAppConfig("paramRegion11"));
            ParamRegion12 = (float)Convert.ToDouble(ConfigHelper.GetAppConfig("paramRegion12"));
            
            Separate0 = (float)Convert.ToDouble(ConfigHelper.GetAppConfig("separate0"));
            Separate1 = (float)Convert.ToDouble(ConfigHelper.GetAppConfig("separate1"));
            Separate2 = (float)Convert.ToDouble(ConfigHelper.GetAppConfig("separate2"));
            Separate3 = (float)Convert.ToDouble(ConfigHelper.GetAppConfig("separate3"));

            ParamRegion21 = (float)Convert.ToDouble(ConfigHelper.GetAppConfig("paramRegion21"));
            ParamRegion22 = (float)Convert.ToDouble(ConfigHelper.GetAppConfig("paramRegion22"));
            ParamRegion31 = (float)Convert.ToDouble(ConfigHelper.GetAppConfig("paramRegion31"));
            ParamRegion32 = (float)Convert.ToDouble(ConfigHelper.GetAppConfig("paramRegion32"));

            ParamHigh = (float)Convert.ToDouble(ConfigHelper.GetAppConfig("paramHigh"));
            Tnor = (float)Convert.ToDouble(ConfigHelper.GetAppConfig("tnor"));
            Tabnor = (float)Convert.ToDouble(ConfigHelper.GetAppConfig("tabnor"));

        }

    }

}