using EVCB_OCPP.Packet20.DataTypes.EnumTypes;
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.DataTypes
{
    public class TransactionType
    {
        /// <summary>
        /// This contains the Id of the transaction.
        /// </summary>
        [Required]
        public string TransactionId { set; get; }

        /// <summary>
        /// Current charging state, is required when state
        /// has changed.Omitted when there is no communication
        /// between EVSE and EV, because no cable is plugged in.
        /// </summary>
        [JsonConverter(typeof(StringEnumConverter))]
        public ChargingStateEnumType? ChargingState { set; get; }

        /// <summary>
        /// Contains the total time that energy flowed from
        ///  EVSE to EV during the transaction(in seconds). Note that
        ///timeSpentCharging is smaller or equal to the duration of
        ///the transaction.
        /// </summary>
        public int? TimeSpentCharging { set; get; }

        /// <summary>
        /// This contains the reason why the transaction
        ///  was stopped.MAY only be omitted when Reason is
        ///"Local".
        /// </summary>
        [JsonConverter(typeof(StringEnumConverter))]
        public ReasonEnumType? StoppedReason { set; get; }

        /// <summary>
        /// The ID given to remote start request
        /// (RequestStartTransactionRequest.This enables to CSMS
        ///to match the started transaction to the given start
        ///request.
        /// </summary>
        public int? RemoteStartId { set; get; }

    }
}
