
enum MessageType {
  success,
  error,
  request
}

extension MessageTypeExtension on MessageType {
  static String toJson(MessageType value) {
    switch (value) {
      case MessageType.success:
        return 'success';
      case MessageType.error:
        return 'error';
      case MessageType.request:
        return 'request';
    }
  }

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