using Common.DevicesModels;
using Common.Models;
using CommunityToolkit.Mvvm.ComponentModel;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Xml.Serialization;

namespace Common
{
    [Serializable]
    public class ProjectProperty : ObservableObject
    {
        private SampleBottleTypeEnum sampleBottleType = SampleBottleTypeEnum._5mL;
        public SampleBottleTypeEnum SampleBottleType
        {
            get => sampleBottleType;
            set => SetProperty(ref sampleBottleType, value);
        }

        private ObservableCollection<BaseBottleBox> _tansferArea = new ObservableCollection<BaseBottleBox>();
        /// <summary>
        /// 投料站 7个传送工装位置
        /// </summary>
        [XmlArray("TransferArea")] // 序列化后的XML节点名
        [XmlArrayItem("BaseBottleBox", Type = typeof(BaseBottleBox))] // 基类元素
        [XmlArrayItem("SampleBottleBoxModel", Type = typeof(SampleBottleBoxModel))] // 派生类元素
        [XmlArrayItem("SourceLiquidBottleBoxModel", Type = typeof(SourceLiquidBottleBoxModel))]
        [XmlArrayItem("SourcePowderBottleBoxModel", Type = typeof(SourcePowderBottleBoxModel))]
        [XmlArrayItem("SourcePowderBottleBoxModel_125ml", Type = typeof(SourcePowderBottleBoxModel_125ml))]
        [XmlArrayItem("TipBoxModel", Type = typeof(TipBoxModel))]
        public ObservableCollection<BaseBottleBox> TransferArea
        {
            get => _tansferArea;
            set => SetProperty(ref _tansferArea, value);
        }

        private ObservableCollection<BaseBottleBox> _fixtureCacheArea=new ObservableCollection<BaseBottleBox>();
        /// <summary>
        /// 投料站8个治具缓存区 ,目前2，6由于干涉取消，但是程序里还保留
        /// </summary>
        [XmlArray("FixtureCacheArea")] // 序列化后的XML节点名
        [XmlArrayItem("BaseBottleBox", Type = typeof(BaseBottleBox))] // 基类元素
        [XmlArrayItem("SampleBottleBoxModel", Type = typeof(SampleBottleBoxModel))] // 派生类元素
        [XmlArrayItem("SourceLiquidBottleBoxModel", Type = typeof(SourceLiquidBottleBoxModel))]
        [XmlArrayItem("SourcePowderBottleBoxModel", Type = typeof(SourcePowderBottleBoxModel))]
        [XmlArrayItem("SourcePowderBottleBoxModel_125ml", Type = typeof(SourcePowderBottleBoxModel_125ml))]
        [XmlArrayItem("TipBoxModel", Type = typeof(TipBoxModel))]
        public ObservableCollection<BaseBottleBox> FixtureCacheArea
        {
            get => _fixtureCacheArea;
            set
            {
                SetProperty(ref _fixtureCacheArea, value);
            }
        }

        private ObservableCollection<SourcePowderBottleModel> powderheadcacheArea = new ObservableCollection<SourcePowderBottleModel>();
        /// <summary>
        /// 投料站粉末头缓存区 10个位置
        /// </summary>
        [XmlArray("PowderHeaderCacheArea")]
        [XmlArrayItem("SourcePowderBottleModel")]
        public ObservableCollection<SourcePowderBottleModel> PowderHeaderCacheArea
        {
            get { return powderheadcacheArea; }
            set { SetProperty(ref powderheadcacheArea, value); }
        }
       
        private ObservableCollection<TipBoxModel> tipHeadArea = new ObservableCollection<TipBoxModel>();
        /// <summary>
        /// 投料站 TIP头放置区域  3个位置
        /// </summary>
        [XmlArray("TipHeadArea")]
        [XmlArrayItem("TipBoxModel")]
        public ObservableCollection<TipBoxModel> TipHeadArea
        {
            get { return tipHeadArea; }
            set { SetProperty(ref tipHeadArea, value); }
        }

        private bool bnouseBS;
        /// <summary>
        /// 不启用BS false:启用BS  true:不启用BS
        /// </summary>
        public bool bNoUseBS
        {
            get { return bnouseBS; }
            set { SetProperty(ref bnouseBS, value); }
        }

        #region 反应工站料架

        private List<_2mlBottleBox_Outer> _2mlbottlebox_outer = new List<_2mlBottleBox_Outer>();
        /// <summary>
        /// 料架上第五层的 2ml外瓶工装集合
        /// </summary>
        public List<_2mlBottleBox_Outer> Rack_2mlBottleBox_OuterList
        {
            get { return _2mlbottlebox_outer; }
            set { _2mlbottlebox_outer = value; }
        }

        private List<_2mlBottleBox_Inner> _2mlbottlebox_inner = new List<_2mlBottleBox_Inner>();
        /// <summary>
        /// 料架上第四层的 2ml滤芯工装集合
        /// </summary>
        public List<_2mlBottleBox_Inner> Rack_2mlBottleBox_InnerList
        {
            get { return _2mlbottlebox_inner; }
            set { _2mlbottlebox_inner = value; }
        }

        private List<SampleBottleBoxModel> _5mlsamplebottlebox = new List<SampleBottleBoxModel>();
        /// <summary>
        /// 料架上第三层的 5ml样品工装集合
        /// </summary>
        public List<SampleBottleBoxModel> Rack_5mlSampleBottleBoxList
        {
            get { return _5mlsamplebottlebox; }
            set { _5mlsamplebottlebox = value; }
        }

        private List<SampleBottleBoxModel> _12mlsamplebottlebox = new List<SampleBottleBoxModel>();
        /// <summary>
        /// 料架上第二层的 12ml样品工装集合
        /// </summary>
        public List<SampleBottleBoxModel> Rack_12mlSampleBottleBoxList
        {
            get { return _12mlsamplebottlebox; }
            set { _12mlsamplebottlebox = value; }
        }

        private List<TipBoxModel> _tipbox = new List<TipBoxModel>();
        /// <summary>
        /// 料架上第一层的 Tip工装集合
        /// </summary>
        public List<TipBoxModel> Rack_TipBoxList
        {
            get { return _tipbox; }
            set { _tipbox = value; }
        }

        private List<SourceLiquidBottleBoxModel> sourceLiquidBottleBoxs = new List<SourceLiquidBottleBoxModel>();
        /// <summary>
        /// 料架上第一层的 原液工装集合
        /// </summary>
        public List<SourceLiquidBottleBoxModel> Rack_SourceLiquidBottlesBoxList
        {
            get { return sourceLiquidBottleBoxs; }
            set { sourceLiquidBottleBoxs = value; }
        }
        #endregion 

        private string lastOpenProject = string.Empty;
        /// <summary>
        /// 关闭软件最后一次打开的项目
        /// </summary>
        public string LastOpenProject
        {
            get => lastOpenProject;
            set => SetProperty(ref lastOpenProject, value);
        }

        private string nowOpenProjectFile;
        public string NowOpenProjectFile
        {
            get => nowOpenProjectFile;
            set => SetProperty(ref nowOpenProjectFile, value);
        }

        private string Dose_ct = string.Empty;
        [XmlIgnore]
        public string Dose_CT
        {
            get => Dose_ct;
            set => SetProperty(ref Dose_ct, value);
        }

        private string react_ct = string.Empty;
        [XmlIgnore]
        public string React_CT
        {
            get => react_ct;
            set => SetProperty(ref react_ct, value);
        }

        public ProjectProperty()
        {

        }
    }
}
