using MainShell.Common;
using MainShell.Process;
using Stylet;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MainShell.Models
{
    public class DieTransferPathItem : PropertyChangedBase
    {
        private int _stepIndex;

        public int StepIndex
        {
            get { return _stepIndex; }
            set { SetAndNotify(ref _stepIndex, value); }
        }

        private int _padRow;

        public int PadRow
        {
            get { return _padRow; }
            set { SetAndNotify(ref _padRow, value); }    
        }

        private int _padColumn;

        public int PadColumn
        {
            get { return _padColumn; }
            set { SetAndNotify(ref _padColumn, value); }
        }

        private int _dieRow;

        public int DieRow
        {
            get { return _dieRow; }
            set { SetAndNotify(ref _dieRow, value); }    
        }

        private int _dieColumn;
        public int DieColumn
        {
            get { return _dieColumn; }
            set { SetAndNotify(ref _dieColumn, value); }
        }

        private double _x1Pos;

        public double X1Pose
        {
            get { return _x1Pos; }
            set { SetAndNotify(ref _x1Pos, value); } 
        }

        private double _y1Pos;

        public double Y1Pos
        {
            get { return _y1Pos; }
            set { SetAndNotify(ref _y1Pos, value); } 
        }

        private double _x2Pos;

        public double X2Pos
        {
            get { return _x2Pos; }
            set { SetAndNotify(ref _x2Pos, value); } 
        }

        private double _y2Pos;

        public double Y2Pos
        {
            get { return _y2Pos; }
            set { SetAndNotify(ref _y2Pos, value); } 
        }

        private TransPathType _transPathType = TransPathType.Nearest;

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

        public static DieTransferPathItem FromPathStep(DieTransferPathStep pathStep)
        {
            if (pathStep == null)
            {
                return null;
            }

            DieTransferPathItem item = new DieTransferPathItem();
            item.StepIndex = pathStep.StepIndex;
            item.DieRow = pathStep.DieRow;
            item.DieColumn = pathStep.DieColumn;
            item.PadRow = pathStep.PadRow;
            item.PadColumn = pathStep.PadColumn;
            item.X1Pose = pathStep.DieX;
            item.Y1Pos = pathStep.DieY;
            item.X2Pos = pathStep.PadX;
            item.Y2Pos = pathStep.PadY;
            item.TransPathType = pathStep.TransPathType;
            return item;
        }
    }
}
