using MwFramework.ManagerService;
using Stylet;
using System.Collections.ObjectModel;
using System.Linq;

namespace MainShell.Recipe.Models.SubstrateParameter
{
    public class MarkCoordinateGenerationState : PropertyChangedBase, IParameterItem
    {
        private int _rows;
        public int Rows
        {
            get { return _rows; }
            set { SetAndNotify(ref _rows, value); }
        }

        private int _cols;
        public int Cols
        {
            get { return _cols; }
            set { SetAndNotify(ref _cols, value); }
        }

        private double _pitchX;
        public double PitchX
        {
            get { return _pitchX; }
            set { SetAndNotify(ref _pitchX, value); }
        }

        private double _pitchY;
        public double PitchY
        {
            get { return _pitchY; }
            set { SetAndNotify(ref _pitchY, value); }
        }

        private ObservableCollection<MarkCoordinatePoint> _points = new ObservableCollection<MarkCoordinatePoint>();
        public ObservableCollection<MarkCoordinatePoint> Points
        {
            get { return _points; }
            set { SetAndNotify(ref _points, value); }
        }

        public IParameterItem Clone()
        {
            return new MarkCoordinateGenerationState
            {
                Rows = Rows,
                Cols = Cols,
                PitchX = PitchX,
                PitchY = PitchY,
                Points = new ObservableCollection<MarkCoordinatePoint>(Points.Select(point => point.Clone() as MarkCoordinatePoint))
            };
        }
    }
}