using Newtonsoft.Json;
using EVCB_OCPP.Packet.Utilities;
using EVCB_OCPP.Packet.Messages.SubTypes;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using EVCB_OCPP.Packet.Features;

namespace EVCB_OCPP.Packet.Messages.Core
{
    public class MeterValuesRequest : IRequest
    {
        public MeterValuesRequest()
        {
            Action = Actions.MeterValues.ToString();
        }

        [JsonIgnore]
        public string Action { set; get; }
        /// <summary>
        /// 充電槍號(開始為1)
        /// </summary>
        [Required]
        public int connectorId { set; get; }

        /// <summary>
        /// 交易 Id
        /// </summary>      
        public int? transactionId { set; get; }

        /// <summary>
        /// 電表資訊
        /// </summary>
        [Required]
        public List<MeterValue> meterValue { set; get; }

        public bool TransactionRelated()
        {
            return true;
        }

        public bool Validate()
        {
            return Validator.TryValidateObject(this, new ValidationContext(this), null, true);
        }
    }
}