using System;
using System.ComponentModel;
using System.Runtime.CompilerServices;
using Autodesk.Navisworks.Api;
using System.Collections.Generic;

namespace NavisworksTransport.UI.WPF.Models
{
    /// <summary>
    /// 层级数据项（支持属性变更通知）
    /// </summary>
    public class HoistingLevelItem : INotifyPropertyChanged
    {
        private int _index;
        private double _heightInMeters;
        private Point3D _horizontalTarget;
        private bool _isRise = true;
        private string _description;

        public int Index
        {
            get => _index;
            set { _index = value; OnPropertyChanged(nameof(Index)); }
        }

        public double HeightInMeters
        {
            get => _heightInMeters;
            set { _heightInMeters = value; OnPropertyChanged(nameof(HeightInMeters)); }
        }

        public Point3D HorizontalTarget
        {
            get => _horizontalTarget;
            set { _horizontalTarget = value; OnPropertyChanged(nameof(HorizontalTarget)); }
        }

        public bool IsRise
        {
            get => _isRise;
            set { _isRise = value; OnPropertyChanged(nameof(IsRise)); }
        }

        public string Description
        {
            get => _description;
            set { _description = value; OnPropertyChanged(nameof(Description)); }
        }

        public event PropertyChangedEventHandler PropertyChanged;

        protected virtual void OnPropertyChanged(string propertyName)
        {
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
        }
    }

    /// <summary>
    /// 吊装路径层高编辑项
    /// </summary>
    public class HoistingLayerEditItem : INotifyPropertyChanged
    {
        private int _displayIndex;
        private double _heightInMeters;
        private string _pointSummary;

        public int DisplayIndex
        {
            get => _displayIndex;
            set { _displayIndex = value; OnPropertyChanged(nameof(DisplayIndex)); }
        }

        /// <summary>
        /// 相对起吊点的绝对高度（米）
        /// </summary>
        public double HeightInMeters
        {
            get => _heightInMeters;
            set { _heightInMeters = value; OnPropertyChanged(nameof(HeightInMeters)); }
        }

        public string PointSummary
        {
            get => _pointSummary;
            set { _pointSummary = value; OnPropertyChanged(nameof(PointSummary)); }
        }

        /// <summary>
        /// 当前层关联的路径点 Id 列表
        /// </summary>
        public List<string> PointIds { get; } = new List<string>();

        public event PropertyChangedEventHandler PropertyChanged;

        protected virtual void OnPropertyChanged(string propertyName)
        {
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
        }
    }
}
