using System.Numerics;
namespace Edge.Core.Domain.FccStationInfo.Input
{
public class StationInfoInput
{
///
/// id
///
public long? Id { get; set; }
///
/// 云端站点 id
///
public string? BuildId { get; set; }
///
/// 站点名称
///
public string? Name { get; set; }
///
/// 客户端id
///
public string SecretId { get; set; }
///
/// 与云端加密的 key
///
public string AcessKey { get; set; }
///
/// 经度
///
public decimal? Longitude { get; set; }
///
/// 纬度
///
public decimal? Latitude { get; set; }
///
/// 小程序链接地址
///
public string? SmallProgram { get; set; }
///
/// 云端地址
///
public string? CloudService { get; set; }
///
/// 云端 MQTT 地址
///
public string? MqttService { get; set; }
///
/// icard 数据库连接地址
///
public string? IcardService { get; set; }
///
/// 本地 fcc 与 fcc 页面 webSocket 端口
///
public string? WebSocketPort { get; set; }
///
/// 支付方式,逗号隔开
///
public string PaymentType { get; set; }
public FccStationInfo? ToComponent()
{
if (IsNotNorm()) return null;
return new FccStationInfo()
{
BuildId = this.BuildId,
Name = this.Name != null ? this.Name : "",
SecretId = this.SecretId,
AcessKey = this.AcessKey,
Longitude = (decimal)(this.Longitude != null ? this.Longitude : new decimal(0)),
Latitude = (decimal)(this.Latitude != null ? this.Latitude : new decimal(0)),
SmallProgram = this.SmallProgram,
CloudService = this.CloudService,
MqttService = this.MqttService,
IcardService = this.IcardService != null ? this.IcardService : "",
WebSocketPort = this.WebSocketPort,
PaymentType = this.PaymentType
};
}
public bool IsNotNorm()
{
return string.IsNullOrEmpty(BuildId) || !Longitude.HasValue || !Latitude.HasValue || string.IsNullOrEmpty(SmallProgram) || string.IsNullOrEmpty(CloudService)
|| string.IsNullOrEmpty(MqttService) || string.IsNullOrEmpty(WebSocketPort);
}
}
}