using System;

namespace NavisworksTransport.Core
{
    /// <summary>
    /// PathPlanningManager事件接口
    /// 定义了业务逻辑与UI解耦的标准事件契约
    /// </summary>
    public interface IPathPlanningManagerEvents
    {
        /// <summary>
        /// 状态变更事件
        /// 当PathPlanningManager的状态发生变化时触发
        /// </summary>
        event EventHandler<PathPlanningStatusChangedEventArgs> StatusChanged;

        /// <summary>
        /// 错误发生事件
        /// 当PathPlanningManager发生错误时触发
        /// </summary>
        event EventHandler<PathPlanningErrorOccurredEventArgs> ErrorOccurred;

        /// <summary>
        /// 路径编辑状态变更事件
        /// 当路径编辑状态发生变化时触发
        /// </summary>
        event EventHandler<PathEditStateChangedEventArgs> EditStateChanged;

        /// <summary>
        /// 通道选择变更事件
        /// 当选择的通道发生变化时触发
        /// </summary>
        event EventHandler<ChannelSelectionChangedEventArgs> ChannelSelectionChanged;

        /// <summary>
        /// 路径点操作事件
        /// 当路径点被添加、删除或修改时触发
        /// </summary>
        event EventHandler<PathPointOperationEventArgs> PathPointOperation;

        /// <summary>
        /// 路径生成事件
        /// 当新路径被生成时触发
        /// </summary>
        event EventHandler<RouteGeneratedEventArgs> RouteGenerated;

        /// <summary>
        /// 路径加载完成事件
        /// 当从数据库加载路径完成时触发
        /// </summary>
        event EventHandler<RoutesLoadedEventArgs> RoutesLoaded;

        /// <summary>
        /// 当前路径变更事件
        /// 当当前活动路径发生变化时触发
        /// </summary>
        event EventHandler<CurrentRouteChangedEventArgs> CurrentRouteChanged;

        /// <summary>
        /// 路径点列表更新事件
        /// 当路径点列表需要更新时触发
        /// </summary>
        event EventHandler<PathPointsListUpdatedEventArgs> PathPointsListUpdated;
    }

    /// <summary>
    /// PathPlanningManager状态接口
    /// 定义了可以被外部查询的状态信息
    /// </summary>
    public interface IPathPlanningManagerState
    {
        /// <summary>
        /// 当前路径编辑状态
        /// </summary>
        PathEditState PathEditState { get; }

        /// <summary>
        /// 当前正在编辑的路径
        /// </summary>
        PathRoute EditingRoute { get; }

        /// <summary>
        /// 是否处于可编辑状态
        /// </summary>
        bool IsInEditableState { get; }

        /// <summary>
        /// 当前活动路径
        /// </summary>
        PathRoute CurrentRoute { get; }

        /// <summary>
        /// 所有路径集合（只读）
        /// </summary>
        System.Collections.Generic.IReadOnlyList<PathRoute> Routes { get; }

        /// <summary>
        /// 选中的通道集合（只读）
        /// </summary>
        System.Collections.Generic.IReadOnlyList<Autodesk.Navisworks.Api.ModelItem> SelectedChannels { get; }

        /// <summary>
        /// 当前设置的路径点类型
        /// </summary>
        PathPointType CurrentPointType { get; }

        /// <summary>
        /// 组合通道边界
        /// </summary>
        ChannelBounds CombinedChannelBounds { get; }
    }

    /// <summary>
    /// PathPlanningManager完整接口
    /// 结合事件和状态接口，提供完整的对外契约
    /// </summary>
    public interface IPathPlanningManager : IPathPlanningManagerEvents, IPathPlanningManagerState
    {
        /// <summary>
        /// Manager的唯一标识符
        /// </summary>
        string ManagerId { get; }

        /// <summary>
        /// 历史记录管理器（只读访问）
        /// </summary>
        PathHistoryManager HistoryManager { get; }
    }
}