using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
using System.Collections.ObjectModel;

namespace INT_PT002.DataStore
{
    #region SystemConfiguration
    public class SystemConfiguration
    {
        #region Field
        private bool m_IS_LOGIN;

        private string m_MAINBOARD_VERSION;
        private int m_RECIPE_NUMBER;

        private Define.E_LanguageID m_LANGUAGE;

        private int m_CHART1_DRAW_STEP;
        private int m_CHART2_DRAW_STEP;

        private int m_LCD_DATA_PERIOD;
        private int m_CHATTERING;
        private int m_JUDGMENT_DELAY_MSEC;
        private int m_BUZZER_OP;

        private int m_SB_DIFF_FILTER;
        private int m_SB_DIFF_MODE;
        private int m_SB_DATA_MODE;
        private int m_SB_DATA_PERIOD;

        private string m_SERIAL_NUMBER;

        private int m_AUTOMATIC_LOGOUT;

        private string m_LEVEL1_NAME;
        private string m_LEVEL2_NAME;
        private string m_LEVEL3_NAME;
        #endregion

        #region Constructor
        public SystemConfiguration()
        {
            this.Initialize();
        }
        #endregion

        #region Property
        public bool IS_LOGIN
        {
            get { return this.m_IS_LOGIN; }
            set { this.m_IS_LOGIN = value; }
        }

        public string MAINBOARD_VERSION
        {
            get { return this.m_MAINBOARD_VERSION; }
            set { this.m_MAINBOARD_VERSION = value; }
        }
        public int RECIPE_NUMBER
        {
            get { return this.m_RECIPE_NUMBER; }
            set { this.m_RECIPE_NUMBER = value; }
        }

        public Define.E_LanguageID LANGUAGE
        {
            get { return this.m_LANGUAGE; }
            set { this.m_LANGUAGE = value; }
        }

        public int CHART1_DRAW_STEP
        {
            get { return this.m_CHART1_DRAW_STEP; }
            set { this.m_CHART1_DRAW_STEP = value; }
        }
        public int CHART2_DRAW_STEP
        {
            get { return this.m_CHART2_DRAW_STEP; }
            set { this.m_CHART2_DRAW_STEP = value; }
        }

        public int LCD_DATA_PERIOD
        {
            get { return this.m_LCD_DATA_PERIOD; }
            set { this.m_LCD_DATA_PERIOD = value; }
        }
        public int CHATTERING
        {
            get { return this.m_CHATTERING; }
            set { this.m_CHATTERING = value; }
        }
        public int JUDGMENT_DELAY_MSEC
        {
            get { return this.m_JUDGMENT_DELAY_MSEC; }
            set { this.m_JUDGMENT_DELAY_MSEC = value; }
        }
        public int BUZZER_OP
        {
            get { return this.m_BUZZER_OP; }
            set { this.m_BUZZER_OP = value; }
        }

        public int SB_DIFF_FILTER
        {
            get { return this.m_SB_DIFF_FILTER; }
            set { this.m_SB_DIFF_FILTER = value; }
        }
        public int SB_DIFF_MODE
        {
            get { return this.m_SB_DIFF_MODE; }
            set { this.m_SB_DIFF_MODE = value; }
        }
        public int SB_DATA_MODE
        {
            get { return this.m_SB_DATA_MODE; }
            set { this.m_SB_DATA_MODE = value; }
        }
        public int SB_DATA_PERIOD
        {
            get { return this.m_SB_DATA_PERIOD; }
            set { this.m_SB_DATA_PERIOD = value; }
        }

        public string SERIAL_NUMBER
        {
            get { return this.m_SERIAL_NUMBER; }
            set { this.m_SERIAL_NUMBER = value; }
        }

        public int AUTOMATIC_LOGOUT
        {
            get { return this.m_AUTOMATIC_LOGOUT; }
            set { this.m_AUTOMATIC_LOGOUT = value; }
        }

        public string LEVEL1_NAME
        {
            get { return this.m_LEVEL1_NAME; }
            set { this.m_LEVEL1_NAME = value; }
        }
        public string LEVEL2_NAME
        {
            get { return this.m_LEVEL2_NAME; }
            set { this.m_LEVEL2_NAME = value; }
        }
        public string LEVEL3_NAME
        {
            get { return this.m_LEVEL3_NAME; }
            set { this.m_LEVEL3_NAME = value; }
        }
        #endregion

        #region Method
        public void Initialize()
        {
            this.IS_LOGIN = false;

            this.MAINBOARD_VERSION = "000";
            this.RECIPE_NUMBER = 1;

            this.LANGUAGE = Define.E_LanguageID.Korean;

            this.CHART1_DRAW_STEP = 4;
            this.CHART2_DRAW_STEP = 2;

            this.LCD_DATA_PERIOD = 100;
            this.CHATTERING = 500;
            this.JUDGMENT_DELAY_MSEC = 2000;
            this.BUZZER_OP = 1000;

            this.SB_DIFF_FILTER = 15;
            this.SB_DATA_MODE = 2;
            this.SB_DATA_PERIOD = 100;
            this.SB_DIFF_MODE = 1;

            this.SERIAL_NUMBER = "23D0000";

            this.AUTOMATIC_LOGOUT = 10;

            this.LEVEL1_NAME = "Level 1";
            this.LEVEL2_NAME = "Level 2";
            this.LEVEL3_NAME = "Level 3";
        }
        #endregion
    }
    #endregion
    #region Struct SystemConfiguration
    [StructLayout(LayoutKind.Sequential)]
    public struct StructSystemConfigurationItem
    {
        public int RECIPE_NUMBER;
        public Define.E_LanguageID LANGUAGE;

        public int CHART1_DRAW_STEP;
        public int CHART2_DRAW_STEP;

        public int LCD_DATA_PERIOD;
        public int CHATTERING;
        public int JUDGMENT_DELAY_MSEC;
        public int BUZZER_OP;

        public int SB_DIFF_FILTER;
        public int SB_DIFF_MODE;
        public int SB_DATA_MODE;
        public int SB_DATA_PERIOD;

        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string SERIAL_NUMBER;

        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 20)]
        public string LEVEL1_NAME;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 20)]
        public string LEVEL2_NAME;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 20)]
        public string LEVEL3_NAME;
    }
    #endregion
}
