using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using EVCB_OCPP.Packet.Utilities;
using EVCB_OCPP.Packet.Messages.SubTypes;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using EVCB_OCPP.Packet.Features;

namespace EVCB_OCPP.Packet.Messages.Core
{
    public class StatusNotificationRequest : IRequest
    {

        public StatusNotificationRequest()
        {
            Action = Actions.StatusNotification.ToString();
        }

        [JsonIgnore]
        public string Action { set; get; }


        [Required]
        public int connectorId { set; get; }

        [Required]
        [JsonConverter(typeof(StringEnumConverter))]
        public ChargePointErrorCode errorCode { set; get; }

    
        [MaxLength(50)]
        public string info { set; get; }

        [Required]
        [JsonConverter(typeof(StringEnumConverter))]
        public ChargePointStatus status { set; get; }

    
        [JsonConverter(typeof(UTCDateTimeConverter))]
        public DateTime? timestamp { set; get; }

  
        [MaxLength(255)]
        public string vendorId { set; get; }


        [MaxLength(50)]
        public string vendorErrorCode { set; get; }


        public bool TransactionRelated()
        {
            return false;
        }

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