ChangeAvailabilityRequest.cs 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. using Newtonsoft.Json;
  2. using Newtonsoft.Json.Converters;
  3. using EVCB_OCPP.Packet.Utilities;
  4. using EVCB_OCPP.Packet.Messages.SubTypes;
  5. using System;
  6. using System.Collections.Generic;
  7. using System.ComponentModel.DataAnnotations;
  8. using System.Linq;
  9. using System.Text;
  10. using System.Threading.Tasks;
  11. using EVCB_OCPP.Packet.Features;
  12. namespace EVCB_OCPP.Packet.Messages.Core
  13. {
  14. public class ChangeAvailabilityRequest : IRequest
  15. {
  16. public ChangeAvailabilityRequest()
  17. {
  18. Action = Actions.ChangeAvailability.ToString();
  19. }
  20. [JsonIgnore]
  21. public string Action { set; get; }
  22. [Required]
  23. public int connectorId { set; get; }
  24. [Required]
  25. [JsonConverter(typeof(StringEnumConverter))]
  26. public AvailabilityType type { set; get; }
  27. public bool TransactionRelated()
  28. {
  29. return false;
  30. }
  31. public bool Validate()
  32. {
  33. return Validator.TryValidateObject(this, new ValidationContext(this), null, true);
  34. }
  35. }
  36. }