using MECF.Framework.UI.Client.ClientBase;
using System.Windows;

namespace MECF.Framework.UI.Client
{
    public class SicModuleUIViewModelBase : UiViewModelBase
    {
        public ModuleInfo CassAL
        {
            get
            {
                if (ModuleManager.ModuleInfos["CassAL"].WaferManager.Wafers.Count > 0)
                    return ModuleManager.ModuleInfos["CassAL"];
                return null;
            }
        }
        public ModuleInfo CassAR
        {
            get
            {
                if (ModuleManager.ModuleInfos["CassAR"].WaferManager.Wafers.Count > 0)
                    return ModuleManager.ModuleInfos["CassAR"];
                return null;
            }
        }
        public ModuleInfo CassBL
        {
            get
            {
                if (ModuleManager.ModuleInfos["CassBL"].WaferManager.Wafers.Count > 0)
                    return ModuleManager.ModuleInfos["CassBL"];
                return null;
            }
        }

        public ModuleInfo Buffer
        {
            get
            {
                if (ModuleManager.ModuleInfos["Buffer"].WaferManager.Wafers.Count > 0)
                    return ModuleManager.ModuleInfos["Buffer"];
                return null;
            }
        }


        public ModuleInfo Aligner { get; set; }
        public ModuleInfo TMRobot { get; set; }
        public ModuleInfo WaferRobot { get; set; }
        public ModuleInfo TrayRobot { get; set; }
        public ModuleInfo LoadLock { get; set; }
        public ModuleInfo UnLoad { get; set; }
        public ModuleInfo PM1 { get; set; }
        public ModuleInfo PM2 { get; set; }


        #region Wafer info for machine


        public WaferInfo BufferWafer
        {
            get
            {
                if (ModuleManager.ModuleInfos["Buffer"].WaferManager.Wafers.Count > 0)
                    return ModuleManager.ModuleInfos["Buffer"].WaferManager.Wafers[0];
                return null;
            }
        }

        public WaferInfo PM1Wafer
        {
            get
            {
                if (ModuleManager.ModuleInfos["PM1"].WaferManager.Wafers.Count > 0)
                    return ModuleManager.ModuleInfos["PM1"].WaferManager.Wafers[0];
                return null;
            }
        }
        public WaferInfo PM2Wafer
        {
            get
            {
                if (ModuleManager.ModuleInfos["PM2"].WaferManager.Wafers.Count > 0)
                    return ModuleManager.ModuleInfos["PM2"].WaferManager.Wafers[0];
                return null;
            }
        }

        public WaferInfo Wafer1
        {
            get
            {
                if (ModuleManager.ModuleInfos["TMRobot"].WaferManager.Wafers.Count > 0)
                    return ModuleManager.ModuleInfos["TMRobot"].WaferManager.Wafers[0];
                return null;
            }
        }
        public WaferInfo TrayRobotWafer
        {
            get
            {
                if (ModuleManager.ModuleInfos["TrayRobot"].WaferManager.Wafers.Count > 0)
                    return ModuleManager.ModuleInfos["TrayRobot"].WaferManager.Wafers[0];
                return null;
            }
        }
        public WaferInfo WaferRobotWafer
        {
            get
            {
                if (ModuleManager.ModuleInfos["WaferRobot"].WaferManager.Wafers.Count > 0)
                    return ModuleManager.ModuleInfos["WaferRobot"].WaferManager.Wafers[0];
                return null;
            }
        }

        #endregion

        #region Tray Visble
        public Visibility TrayRobotHaveTray
        {
            get
            {
                if (ModuleManager.ModuleInfos["TrayRobot"].WaferManager.Wafers.Count > 0 && ModuleManager.ModuleInfos["TrayRobot"].WaferManager.Wafers[0].TrayStatus > 0)
                {
                    return Visibility.Visible;
                }
                return Visibility.Hidden;
            }
        }

        public Visibility TMRobotHaveTray
        {
            get
            {
                if (ModuleManager.ModuleInfos["TMRobot"].WaferManager.Wafers.Count > 0 && ModuleManager.ModuleInfos["TMRobot"].WaferManager.Wafers[0].TrayStatus > 0)
                {
                    return Visibility.Visible;
                }
                return Visibility.Hidden;
            }
        }

        public Visibility LoadLockHaveTray
        {
            get
            {
                if (ModuleManager.ModuleInfos["LoadLock"].WaferManager.Wafers.Count > 0 && ModuleManager.ModuleInfos["LoadLock"].WaferManager.Wafers[0].TrayStatus > 0)
                {
                    return Visibility.Visible;
                }
                return Visibility.Hidden;
            }
        }

        public Visibility UnLoadHaveTray
        {
            get
            {
                if (ModuleManager.ModuleInfos["UnLoad"].WaferManager.Wafers.Count > 0 && ModuleManager.ModuleInfos["UnLoad"].WaferManager.Wafers[0].TrayStatus > 0)
                {
                    return Visibility.Visible;
                }
                return Visibility.Hidden;
            }
        }

        public Visibility PM1HaveTray
        {
            get
            {
                if (ModuleManager.ModuleInfos["PM1"].WaferManager.Wafers.Count > 0 && ModuleManager.ModuleInfos["PM1"].WaferManager.Wafers[0].TrayStatus > 0)
                {
                    return Visibility.Visible;
                }
                return Visibility.Hidden;
            }
        }

        public Visibility PM2HaveTray
        {
            get
            {
                if (ModuleManager.ModuleInfos["PM2"].WaferManager.Wafers.Count > 0 && ModuleManager.ModuleInfos["PM2"].WaferManager.Wafers[0].TrayStatus > 0)
                {
                    return Visibility.Visible;
                }
                return Visibility.Hidden;
            }
        }
        #endregion


        protected void InitPM()
        {
            TMRobot = ModuleManager.ModuleInfos["TMRobot"];
            PM1 = ModuleManager.ModuleInfos["PM1"];
            PM2 = ModuleManager.ModuleInfos["PM2"];
        }

    }
}
