using System.Collections.Generic;
using CounterDrone.Core.Models;
using SQLite;

namespace CounterDrone.Core.Models
{
    /// <summary>航线模板（基础数据模板）</summary>
    [Table("RouteTemplate")]
    public class RouteTemplate
    {
        [PrimaryKey]
        public string Id { get; set; } = "";
        public string Name { get; set; } = "";
        public string WaypointsJson { get; set; } = "[]";
        [Ignore]
        public List<WaypointCoord> Waypoints { get; set; } = new();

        public List<Waypoint> ToWaypoints(double speed)
        {
            var list = new List<Waypoint>();
            foreach (var w in Waypoints)
                list.Add(new Waypoint
                {
                    PosX = w.X, PosY = w.Y, PosZ = w.Z,
                    Altitude = w.Y, Speed = speed,
                });
            return list;
        }
    }

    public class WaypointCoord
    {
        public double X { get; set; }
        public double Y { get; set; }
        public double Z { get; set; }
    }
}
