using LY.App.Device;
using Newtonsoft.Json;
using SqlSugar;
namespace LY.App.Model
{
    [SugarTable("ly_device_info")]
    public class DeviceEntity : BaseEntity
    {
        /// 
        /// 
        /// 
        [SugarColumn(ColumnName = "device_sn", ColumnDescription = "DeviceSN")]
        public string DeviceSN { get; set; }
        [SugarColumn(Length = 63, IsNullable = true, ColumnDescription = "Name")]
        public string Name { get; set; }
        [SugarColumn(Length = 63, IsNullable = true, ColumnDescription = "account")]
        public string account { get; set; }
        [SugarColumn(Length = 63, IsNullable = true, ColumnDescription = "password")]
        public string password { get; set; }
        [JsonConverter(typeof(ValueToStringConverter))]
        [SugarColumn(ColumnName = "position_id", ColumnDescription = "阵地id")]
        public long PositionId { get; set; }
        /// 
        /// 阵地名称
        /// 
        [SugarColumn(ColumnName = "position_name", ColumnDescription = "阵地名称")]
        public string PositionName { get; set; }
        public string ip { get; set; }
        public ProtocolType Protocol { get; set; }
        public int Port { get; set; }
        [SugarColumn(IsNullable = true)]
        public string GraphQlEndpoint { get; set; }
        [SugarColumn(IsNullable = true)]
        public string BrokerAddress { get; set; }  // MQTT Broker 地址
        [SugarColumn(IsNullable = true)]
        public string Topic { get; set; }          // MQTT 主题
        /// 
        /// 机型
        /// 
        [SugarColumn(Length = 63, IsNullable = true, ColumnDescription = "机型")]
        public string Model { get; set; }
        /// 
        /// 位置
        /// 
        [SugarColumn(ColumnName = "address", ColumnDescription = "位置", IsNullable = true)]
        public string Address { get; set; }
        /// 
        /// 经度
        /// 
        [SugarColumn(ColumnName = "lon", ColumnDescription = "经度", IsNullable = true)]
        public double Lon { get; set; }
        /// 
        /// 纬度
        /// 
        [SugarColumn(ColumnName = "lat", ColumnDescription = "纬度", IsNullable = true)]
        public double Lat { get; set; }
        /// 
        /// 高度
        /// 
        [SugarColumn(ColumnName = "alt", ColumnDescription = "高度", IsNullable = true)]
        public double Alt { get; set; }
        [SugarColumn(ColumnName = "img", ColumnDescription = "图片", IsNullable = true)]
        /// 
        /// 图片
        /// 
        public string Img { get; set; }
    }
    public class AddDevice
    {
        public long PositionId { get; set; }
        /// 
        /// 阵地名称
        /// 
        public string PositionName { get; set; }
        public string account { get; set; }
        public string password { get; set; }
        public string Name { get; set; }
        public string DeviceSN { get; set; }
        public string ip { get; set; }
        public ProtocolType Protocol { get; set; }
        public int Port { get; set; }
        public string GraphQlEndpoint { get; set; }
        public string BrokerAddress { get; set; }  // MQTT Broker 地址
        public string Topic { get; set; }          // MQTT 主题
        /// 
        /// 机型
        /// 
        public string Model { get; set; }
        /// 
        /// 位置
        /// 
        public string Address { get; set; }
        /// 
        /// 经度
        /// 
        public double Lon { get; set; }
        /// 
        /// 纬度
        /// 
        public double Lat { get; set; }
        /// 
        /// 图片
        /// 
        public string Img { get; set; }
    }
    public class UpdateDevice : AddDevice
    {
        public long Id { get; set; }
    }
}