using CounterDrone.Core.Models;
using SQLite;

namespace CounterDrone.Core.Models
{
    /// <summary>传感器规格（基础数据模板）</summary>
    [Table("SensorSpec")]
    public class SensorSpec
    {
        [PrimaryKey]
        public string Id { get; set; } = "";
        public string Name { get; set; } = "";
        public double RadarRange { get; set; }
        public double EORange { get; set; }
        public double IRRange { get; set; }
        public double Accuracy { get; set; } = 50.0;

        /// <summary>3D 模型 ID（FK → ModelInfo），Unity 可视化用</summary>
        public string ModelId { get; set; } = "";
        public double? MinElevation { get; set; }
        public double? MaxElevation { get; set; }
        public double? MinDetectAlt { get; set; }
        public double? MaxDetectAlt { get; set; }

        public ScenarioUnit ToScenarioUnit(double posX, double posY, double posZ)
        {
            return new ScenarioUnit
            {
                SensorSpecId = Id,
                EquipmentRole = (int)Models.EquipmentRole.Detection,
                Quantity = 1,
                PositionX = posX,
                PositionY = posY,
                PositionZ = posZ,
            };
        }
    }
}
