using EVCB_OCPP.Packet20.DataTypes;
using EVCB_OCPP.Packet20.DataTypes.EnumTypes;
using EVCB_OCPP.Packet20.Utilites;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace EVCB_OCPP.Packet20.Messages
{
public class TransactionEventRequest
{
///
/// This contains the type of this event. The first
/// TransactionEvent of a transaction SHALL contain:
///"Started" The last TransactionEvent of a transaction
///SHALL contain: "Ended" All others SHALL contain:
///"Updated"
///
[Required]
[JsonConverter(typeof(StringEnumConverter))]
public TransactionEventEnumType EventType { set; get; }
///
/// The date and time at which this transaction
///event occurred.
///
[Required]
[JsonConverter(typeof(UTCDateTimeConverter))]
public DateTime Timestamp { set; get; }
///
/// Reason the Charging Station sends this
///message to the CSMS
///
[Required]
[JsonConverter(typeof(StringEnumConverter))]
public TriggerReasonEnumType TriggerReason { set; get; }
///
/// Incremental sequence number, helps with
///determining if all messages of a transaction have been
/// received
///
[Required]
public int SeqNo { set; get; }
///
/// Indication that this transaction event happened
/// when the Charging Station was offline.Default = false,
/// meaning: the event occurred when the Charging Station
/// was online.
///
public bool? Offline { set; get; }
///
/// If the Charging Station is able to report the
/// number of phases used, then it SHALL provide it.When
/// omitted the CSMS may be able to determine the number
/// of phases used via device management
///
public int? NumberOfPhasesUsed { set; get; }
///
/// The maximum current of the connected cable in
///Ampere(A).
///
public decimal? CableMaxCurrent { set; get; }
///
/// his contains the Id of the reservation that
/// terminates as a result of this transaction.
///
public int? ReservationId { set; get; }
///
/// Contains transaction specific information
///
[Required]
public TransactionType TransactionInfo { set; get; }
///
/// This contains the identifier for which a
///transaction has to be/was started.Is required when the
/// EV Driver becomes authorized for this transaction.The
/// IdToken should only be send once in a
/// TransactionEventRequest for every authorization done
/// for this transaction.
///
public IdTokenType IdToken { set; get; }
///
/// This identifies which evse (and connector) of
///the Charging Station is used.
///
public EVSEType Evse { set; get; }
///
/// This contains the relevant meter values.
/// Depending on the EventType of this TransactionEvent the
/// following Configuration Variable is used to configure the
///content:
///Started: SampledDataTxStartedMeasurands
/// Updated: SampledDataTxUpdatedMeasurands
/// Ended: SampledDataTxEndedMeasurands &
///AlignedDataTxEndedMeasurands
///
public List MeterValue { set; get; }
}
}