
enum MessageType {
  success,
  processed,
  error,
  request
}

extension MessageTypeExtension on MessageType {
  static String toJson(MessageType value) => value.name;

  static MessageType fromJson(String json) {
    switch (json) {
      case 'success':
        return MessageType.success;
      case 'error':
        return MessageType.error;
      case 'request':
        return MessageType.request;
      case 'processed':
        return MessageType.processed;
      default:
        throw ArgumentError('Unknown HTTPMType string: $json');
    }
  }
}
