using Newtonsoft.Json; using Newtonsoft.Json.Converters; using EVCB_OCPP.Packet.Utilities; using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Linq; using System.Text; using System.Threading.Tasks; using EVCB_OCPP.Packet.Messages.SubTypes; using EVCB_OCPP.Packet.Features; namespace EVCB_OCPP.Packet.Messages.Core { public class StopTransactionRequest : IRequest { public StopTransactionRequest() { Action = Actions.StopTransaction.ToString(); } [JsonIgnore] public string Action { set; get; } /// /// Authorization Id /// public string idTag { set; get; } /// /// 充電結束的電表讀數 /// [Required] public int meterStop { set; get; } /// /// 交易Id /// [Required] public int transactionId { set; get; } /// /// 結束原因 /// [JsonConverter(typeof(StringEnumConverter))] public Reason? reason { set; get; } /// /// 結束交易的時間 /// [Required] [JsonConverter(typeof(UTCDateTimeConverter))] public DateTime timestamp { set; get; } /// /// 交易資料 (可包含交易細節 & 帳單) /// public List transactionData { set; get; } public bool TransactionRelated() { return true; } public bool Validate() { return Validator.TryValidateObject(this, new ValidationContext(this), null, true); } } }