using System;
using SQLite;

namespace CounterDrone.Core.Models
{
    /// <summary>步骤3：装备部署</summary>
    [Table("EquipmentDeployment")]
    public class EquipmentDeployment
    {
        [PrimaryKey]
        public string Id { get; set; } = Guid.NewGuid().ToString();

        [Indexed]
        public string TaskId { get; set; } = string.Empty;

        public int EquipmentRole { get; set; } = (int)Models.EquipmentRole.LaunchPlatform;

        public int Quantity { get; set; } = 1;

        public string WaveId { get; set; } = string.Empty;

        // 发射平台专用
        public int? PlatformType { get; set; }

        public double PositionX { get; set; }
        public double PositionY { get; set; }
        public double PositionZ { get; set; }

        public int? AerosolType { get; set; }

        public int? MunitionCount { get; set; }

        /// <summary>火炮/发射器数量（null=1）</summary>
        public int? GunCount { get; set; }

        /// <summary>每门炮的火力通道数（null=1）</summary>
        public int? ChannelsPerGun { get; set; }

        /// <summary>同一通道连发最小间隔秒（null=1）</summary>
        public double? ChannelInterval { get; set; }

        public int Source { get; set; } = (int)ConfigSource.Manual;

        public double? MuzzleVelocity { get; set; }

        public double? ReleaseAltitude { get; set; }

        public double Cooldown { get; set; } = 5.0;

        /// <summary>空基平台巡航速度 m/s（地基为 NULL）</summary>
        public double? CruiseSpeed { get; set; }

        // ── 探测能力（独立探测设备和火力单元自带探测统一表达）──
        /// <summary>雷达探测距离 m（雨雾不衰减，发射平台也可有）</summary>
        public double? RadarRange { get; set; }
        /// <summary>光电探测距离 m（受 Visibility 衰减）</summary>
        public double? EORange { get; set; }
        /// <summary>红外探测距离 m（不受 Visibility 影响）</summary>
        public double? IRRange { get; set; }
        /// <summary>探测精度 m（位置误差，影响抛撒散布范围）</summary>
        public double? DetectionAccuracy { get; set; }

        // ── 三维球冠几何参数（探测范围约束）──
        /// <summary>俯仰角下限（度），NULL=无限制（等价全向）</summary>
        public double? MinElevation { get; set; }
        /// <summary>俯仰角上限（度），NULL=无限制</summary>
        public double? MaxElevation { get; set; }
        /// <summary>可探测高度下界 m，NULL=无限制</summary>
        public double? MinDetectAlt { get; set; }
        /// <summary>可探测高度上界 m，NULL=无限制</summary>
        public double? MaxDetectAlt { get; set; }
    }
}
