SecurityEventNotificationRequest.cs 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. using EVCB_OCPP.Packet.Features;
  2. using EVCB_OCPP.Packet.Utilities;
  3. using Newtonsoft.Json;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.ComponentModel.DataAnnotations;
  7. using System.Linq;
  8. using System.Text;
  9. using System.Threading.Tasks;
  10. namespace EVCB_OCPP.Packet.Messages.Security
  11. {
  12. public class SecurityEventNotificationRequest:IRequest
  13. {
  14. public SecurityEventNotificationRequest()
  15. {
  16. Action = Actions.SecurityEventNotification.ToString();
  17. }
  18. /// <summary>
  19. /// Type of the security event (See list of currently known security events)
  20. /// </summary>
  21. [Required]
  22. [StringLength(50,MinimumLength =0)]
  23. public string type { set; get; }
  24. /// <summary>
  25. /// Date and time at which the event occurred.
  26. /// </summary>
  27. [Required]
  28. [JsonConverter(typeof(UTCDateTimeConverter))]
  29. public DateTime timestamp { set; get; }
  30. /// <summary>
  31. /// Additional information about the occurred security event.
  32. /// </summary>
  33. [Required]
  34. [StringLength(255, MinimumLength = 0)]
  35. public string techInfo { set; get; }
  36. [JsonIgnore]
  37. public string Action { set; get; }
  38. public bool TransactionRelated()
  39. {
  40. return false;
  41. }
  42. public bool Validate()
  43. {
  44. return Validator.TryValidateObject(this, new ValidationContext(this), null, true);
  45. }
  46. }
  47. }