using MainShell.Common;
using MainShell.Models;
using MainShell.Process;
using MwFramework.ManagerService;
using Stylet;
using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MainShell.Manual.Model
{
    [Export(typeof(IParameter))]
    public class DieBondingManualSetting : ParameterBase
    {
        public DieBondingManualSysItem DieBondingManualSysItem { get; set; } = new DieBondingManualSysItem();

        public override void Copy(IParameter source)
        {
            if (source is DieBondingManualSetting item)
            {
                this.DieBondingManualSysItem = item.DieBondingManualSysItem.Clone() as DieBondingManualSysItem;
            }
        }
    }

    public class DieBondingManualSysItem : PropertyChangedBase, IParameterItem
    {
        private RegionModel _substrateRegion = new RegionModel();

        public RegionModel SubstrateRegion
        {
            get { return _substrateRegion; }
            set { SetAndNotify(ref _substrateRegion, value); }
        }

        private RegionModel _dieRegion = new RegionModel();

        public RegionModel DieRegion
        {
            get { return _dieRegion; }
            set { SetAndNotify(ref _dieRegion, value); }
        }

        private TransPathType _transPathType = TransPathType.Sequence;

        public TransPathType TransPathType
        {
            get { return _transPathType; }
            set { SetAndNotify(ref _transPathType, value); }
        }

        private DieTransferRowTraversalStrategy _padRowDirectionStrategy = DieTransferRowTraversalStrategy.AllPositive;

        public DieTransferRowTraversalStrategy PadRowDirectionStrategy
        {
            get { return _padRowDirectionStrategy; }
            set { SetAndNotify(ref _padRowDirectionStrategy, value); }
        }

        private DieTransferRowTraversalStrategy _dieRowDirectionStrategy = DieTransferRowTraversalStrategy.Serpentine;

        public DieTransferRowTraversalStrategy DieRowDirectionStrategy
        {
            get { return _dieRowDirectionStrategy; }
            set { SetAndNotify(ref _dieRowDirectionStrategy, value); }
        }

        //使用自动计算芯片模式
        private bool _autoDieRegionModeEnable = false;

        public bool AutoDieRegionModeEnable
        {
            get { return _autoDieRegionModeEnable; }
            set { SetAndNotify(ref _autoDieRegionModeEnable, value); }
        }



        public IParameterItem Clone()
        {
            return new DieBondingManualSysItem()
            {
                SubstrateRegion = this.SubstrateRegion.Clone() as RegionModel,
                DieRegion = this.DieRegion.Clone() as RegionModel,
                TransPathType = this.TransPathType,
                PadRowDirectionStrategy = this.PadRowDirectionStrategy,
                DieRowDirectionStrategy = this.DieRowDirectionStrategy,
                AutoDieRegionModeEnable = this.AutoDieRegionModeEnable
            };
        }
    }
}
