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

namespace INT_PT002.DataStore
{
    #region UserGroup
    public class UserGroup
    {
        #region Field
        private UserGroupItem m_Level1;
        private UserGroupItem m_Level2;
        private UserGroupItem m_Level3;
        private UserGroupItem m_Admin;
        #endregion

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

        #region Property
        public UserGroupItem Level1
        {
            get { return this.m_Level1; }
            set { this.m_Level1 = value; }
        }
        public UserGroupItem Level2
        {
            get { return this.m_Level2; }
            set { this.m_Level2 = value; }
        }
        public UserGroupItem Level3
        {
            get { return this.m_Level3; }
            set { this.m_Level3 = value; }
        }
     
        public UserGroupItem Admin
        {
            get { return this.m_Admin; }
            set { this.m_Admin = value; }
        }
        #endregion

        #region Method
        private void Initialize()
        {
            this.Level1 = new UserGroupItem();
            this.Level2 = new UserGroupItem();
            this.Level3 = new UserGroupItem();
            this.Admin = new UserGroupItem();
        }

        public bool GetSet1AccessRight(Define.E_FormStore display)
        {
            bool ret = false;

            return ret;
        }
        public bool GetSet2AccessRight(Define.E_FormStore display)
        {
            bool ret = false;

            return ret;
        }
        public bool GetSet3AccessRight(Define.E_FormStore display)
        {
            bool ret = false;

            return ret;
        }
        #endregion
    }
    #endregion
    #region UserGroupItem
    public class UserGroupItem
    {
        #region Field
        private bool m_IsMainDisplayProductChange;
        private bool m_IsMainDisplayClear;
        private bool m_IsMainDisplaySubMenu;

        private bool m_IsMenuRecipe;
        private bool m_IsMenuUserSetting;
        private bool m_IsMenuUserGroupEditor;
        private bool m_IsMenuIOTest;
        private bool m_IsMenuHistoryLog;
        private bool m_IsMenuInspectionLog;
        private bool m_IsMenuAlarmLog;
        private bool m_IsMenuInformation;
        private bool m_IsMenuStatus;
        #endregion

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

        #region Property
        public bool IsMainDisplayProductChange
        {
            get { return this.m_IsMainDisplayProductChange; }
            set { this.m_IsMainDisplayProductChange = value; }
        }
        public bool IsMainDisplayClear
        {
            get { return this.m_IsMainDisplayClear; }
            set { this.m_IsMainDisplayClear = value; }
        }
        public bool IsMainDisplaySubMenu
        {
            get { return this.m_IsMainDisplaySubMenu; }
            set { this.m_IsMainDisplaySubMenu = value; }
        }

        public bool IsMenuRecipe
        {
            get { return this.m_IsMenuRecipe; }
            set { this.m_IsMenuRecipe = value; }
        }
        public bool IsMenuUserSetting
        {
            get { return this.m_IsMenuUserSetting; }
            set { this.m_IsMenuUserSetting = value; }
        }
        public bool IsMenuUserGroupEditor
        {
            get { return this.m_IsMenuUserGroupEditor; }
            set { this.m_IsMenuUserGroupEditor = value; }
        }
        public bool IsMenuIOTest
        {
            get { return this.m_IsMenuIOTest; }
            set { this.m_IsMenuIOTest = value; }
        }

        public bool IsMenuHistoryLog
        {
            get { return this.m_IsMenuHistoryLog; }
            set { this.m_IsMenuHistoryLog = value; }
        }
        public bool IsMenuInspectionLog
        {
            get { return this.m_IsMenuInspectionLog; }
            set { this.m_IsMenuInspectionLog = value; }
        }
        public bool IsMenuAlarmLog
        {
            get { return this.m_IsMenuAlarmLog; }
            set { this.m_IsMenuAlarmLog = value; }
        }
        public bool IsMenuInformation
        {
            get { return this.m_IsMenuInformation; }
            set { this.m_IsMenuInformation = value; }
        }
        public bool IsMenuStatus
        {
            get { return this.m_IsMenuStatus; }
            set { this.m_IsMenuStatus = value; }
        }

        public bool IsMainEnable
        {
            get
            {
                bool ret = false;

                if (this.IsMainDisplayProductChange == true || this.IsMainDisplayClear == true
                    || this.IsMainDisplaySubMenu == true)
                    ret = true;

                return ret;
            }
        }
        public bool IsRecipeEnable
        {
            get
            {
                bool ret = false;

                if (this.IsMenuRecipe == true)
                    ret = true;

                return ret;
            }
        }
        public bool IsUserEnable
        {
            get
            {
                bool ret = false;

                if (this.IsMenuUserSetting == true || this.IsMenuUserGroupEditor == true)
                    ret = true;

                return ret;
            }
        }
        public bool IsManualEnable
        {
            get
            {
                bool ret = false;

                if (this.IsMenuIOTest == true)
                    ret = true;

                return ret;
            }
        }
        public bool IsLogEnable
        {
            get
            {
                bool ret = false;

                if (this.IsMenuHistoryLog == true || this.IsMenuInspectionLog == true || this.IsMenuAlarmLog == true)
                    ret = true;

                return ret;
            }
        }
        public bool IsSystemEnable
        {
            get
            {
                bool ret = false;

                if (this.IsMenuInformation == true || this.IsMenuStatus == true)
                    ret = true;

                return ret;
            }
        }
        #endregion

        #region Method
        private void Initialize()
        {
            this.IsMainDisplayProductChange = false;
            this.IsMainDisplayClear = false;
            this.IsMainDisplaySubMenu = false;

            this.IsMenuRecipe = false;
            this.IsMenuUserSetting = false;
            this.IsMenuUserGroupEditor = false;
            this.IsMenuIOTest = false;
            this.IsMenuHistoryLog = false;
            this.IsMenuInspectionLog = false;
            this.IsMenuAlarmLog = false;
            this.IsMenuInformation = false;
            this.IsMenuStatus = false;
        }
        #endregion
    }
    #endregion
    #region StructUserGroupItem(총 메뉴 개수 30개)
    [StructLayout(LayoutKind.Sequential)]
    public struct StructUserGroupItem
    {
        public bool IsMainDisplayRecipeChange;
        public bool IsMainDisplayClear;
        public bool IsMainDispalySubMenu;

        public bool IsMenuRecipe;
        public bool IsMenuUserSetting;
        public bool IsMenuUserGroupEditor;
        public bool IsMenuIOTest;
        public bool IsMenuEquipmentLog;
        public bool IsMenuCheckLog;
        public bool IsMenuAlarmList;
        public bool IsMenuInformation;
        public bool IsMenuStatus;

        public bool Dummy1;
        public bool Dummy2;
        public bool Dummy3;
        public bool Dummy4;
        public bool Dummy5;
        public bool Dummy6;
        public bool Dummy7;
        public bool Dummy8;
        public bool Dummy9;
        public bool Dummy10;
        public bool Dummy11;
        public bool Dummy12;
        public bool Dummy13;
        public bool Dummy14;
        public bool Dummy15;
        public bool Dummy16;
        public bool Dummy17;
        public bool Dummy18;
    }
    #endregion

    #region UserItem
    public class UserItem
    {
        #region Field
        private bool m_IsUpdate;

        private string m_ID;
        private string m_Password;
        private string m_PreviousPassword1;
        private string m_PreviousPassword2;
        private string m_PreviousPassword3;

        private int m_ExpireAccount;
        private int m_ExpirePassword;

        private bool m_IsLockAccount;
        private bool m_IsLockPassword;

        private DateTime m_DateRegister;
        private DateTime m_DateLogin;
        private DateTime m_DateExpireRegister;
        private DateTime m_DateExpireLogin;

        private Define.E_UserStatus m_Status;

        private bool m_IsAdmin;

        private int m_ActiveLevel;
        #endregion

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

        #region Property
        public bool IsUpdate
        {
            get { return this.m_IsUpdate; }
            set { this.m_IsUpdate = value; }
        }

        public string ID
        {
            get { return this.m_ID; }
            set { this.m_ID = value; }
        }
        public string Password
        {
            get { return this.m_Password; }
            set { this.m_Password = value; }
        }
        public string PreviousPassword1
        {
            get { return this.m_PreviousPassword1; }
            set { this.m_PreviousPassword1 = value; }
        }
        public string PreviousPassword2
        {
            get { return this.m_PreviousPassword2; }
            set { this.m_PreviousPassword2 = value; }
        }
        public string PreviousPassword3
        {
            get { return this.m_PreviousPassword3; }
            set { this.m_PreviousPassword3 = value; }
        }

        public int ExpireAccount
        {
            get { return this.m_ExpireAccount; }
            set { this.m_ExpireAccount = value; }
        }
        public int ExpirePassword
        {
            get { return this.m_ExpirePassword; }
            set { this.m_ExpirePassword = value; }
        }

        public bool IsLockAccount
        {
            get { return this.m_IsLockAccount; }
            set { this.m_IsLockAccount = value; }
        }
        public bool IsLockPassword
        {
            get { return this.m_IsLockPassword; }
            set { this.m_IsLockPassword = value; }
        }

        public DateTime DateRegister
        {
            get { return this.m_DateRegister; }
            set { this.m_DateRegister = value; }
        }
        public DateTime DateLogin
        {
            get { return this.m_DateLogin; }
            set { this.m_DateLogin = value; }
        }
        public DateTime DateExpireRegister
        {
            get { return this.m_DateExpireRegister; }
            set { this.m_DateExpireRegister = value; }
        }
        public DateTime DateExpireLogin
        {
            get { return this.m_DateExpireLogin; }
            set { this.m_DateExpireLogin = value; }
        }

        public Define.E_UserStatus Status
        {
            get { return this.m_Status; }
            set { this.m_Status = value; }
        }

        public bool IsAdmin
        {
            get { return this.m_IsAdmin; }
            set { this.m_IsAdmin = value; }
        }

        public int ActiveLevel
        {
            get { return this.m_ActiveLevel; }
            set { this.m_ActiveLevel = value; }
        }
        #endregion

        #region Method
        private void Initialize()
        {
            this.IsUpdate = false;

            this.ID = "";
            this.Password = "";

            this.PreviousPassword1 = "";
            this.PreviousPassword2 = "";
            this.PreviousPassword3 = "";

            this.ExpireAccount = 0;
            this.ExpirePassword = 0;

            this.DateRegister = DateTime.Now;
            this.DateLogin = DateTime.Now;
            this.DateExpireRegister = DateTime.Now;
            this.DateExpireLogin = DateTime.Now;

            this.Status = Define.E_UserStatus.None;

            this.IsAdmin = false;

            this.ActiveLevel = 1;
        }

        public void SetPassword(string pass)
        {
            this.PreviousPassword3 = this.PreviousPassword2;
            this.PreviousPassword2 = this.PreviousPassword1;
            this.PreviousPassword1 = pass;
            this.Password = pass;
        }
        public bool CheckID(string id)
        {
            bool ret = false;


            return ret;
        }
        public bool CheckPassword(string pass)
        {
            bool ret = false;

            return ret;
        }
        #endregion
    }
    #endregion
}
