using System;
using System.Collections.Generic;
using Autodesk.Navisworks.Api;
using NavisworksTransport.Core.Animation;

namespace NavisworksTransport.Core.Collision
{
    /// <summary>
    /// 批处理碰撞检测纯计算接口
    /// 关键特性：完全不涉及UI操作（鼠标光标、视图重绘、DispatcherTimer）
    /// </summary>
    public interface IBatchCollisionProcessor
    {
        /// <summary>
        /// 预计算动画帧和碰撞（纯计算，无UI操作）
        /// </summary>
        /// <param name="route">路径</param>
        /// <param name="animatedObject">动画对象（可为null，表示使用虚拟物体）</param>
        /// <param name="isVirtualObject">是否使用虚拟物体</param>
        /// <param name="virtualObjectLength">虚拟物体长度（米）</param>
        /// <param name="virtualObjectWidth">虚拟物体宽度（米）</param>
        /// <param name="virtualObjectHeight">虚拟物体高度（米）</param>
        /// <param name="frameRate">帧率</param>
        /// <param name="duration">持续时间（秒）</param>
        /// <param name="detectionGap">检测间隙（米）</param>
        /// <param name="manualDetectionTargets">手动指定的检测目标（可选）</param>
        /// <param name="objectRotationCorrection">物体旋转修正角度（度）</param>
        /// <param name="excludedObjects">排除列表（可选）</param>
        /// <returns>动画帧列表</returns>
        List<AnimationFrame> PrecomputeFrames(
            PathRoute route,
            ModelItem animatedObject,
            bool isVirtualObject,
            double virtualObjectLength,
            double virtualObjectWidth,
            double virtualObjectHeight,
            int frameRate,
            double duration,
            double detectionGap,
            List<ModelItem> manualDetectionTargets = null,
            double objectRotationCorrection = 0.0,
            List<ModelItem> excludedObjects = null);

        /// <summary>
        /// 创建并运行ClashDetective测试（纯计算，无UI操作）
        /// 返回测试名称，用于关联到ClashDetectiveResults表
        /// </summary>
        /// <param name="precomputedCollisions">预计算的碰撞结果</param>
        /// <param name="detectionGap">检测间隙（米）</param>
        /// <param name="pathName">路径名称</param>
        /// <param name="routeId">路径ID</param>
        /// <param name="animatedObject">动画对象（可为null，表示使用虚拟物体）</param>
        /// <param name="isVirtualObject">是否使用虚拟物体</param>
        /// <param name="frameRate">帧率</param>
        /// <param name="duration">持续时间（秒）</param>
        /// <param name="virtualObjectLength">虚拟物体长度（米）</param>
        /// <param name="virtualObjectWidth">虚拟物体宽度（米）</param>
        /// <param name="virtualObjectHeight">虚拟物体高度（米）</param>
        /// <param name="pathPoints">路径点列表（用于测试完成后恢复物体位置）</param>
        /// <param name="detectionRecordId">检测记录ID（关联CollisionDetectionRecords表）</param>
        /// <returns>ClashDetective测试名称</returns>
        string CreateAndRunClashDetectiveTest(
            List<CollisionResult> precomputedCollisions,
            double detectionGap,
            string pathName,
            string routeId,
            ModelItem animatedObject,
            bool isVirtualObject,
            int frameRate,
            double duration,
            double virtualObjectLength,
            double virtualObjectWidth,
            double virtualObjectHeight,
            List<Point3D> pathPoints = null,
            int? detectionRecordId = null);
    }
}