package com.palacesun.engine.gateway.netty.framework;

import com.palacesun.engine.gateway.EncryptionGatewayManager;
import com.palacesun.masking.tools.EngineUtil;
import io.netty.handler.codec.http.FullHttpRequest;
import io.netty.util.CharsetUtil;

public class GatewayRequestHandler {
   static final String REQUEST_PREFIX = "/encryptionGatewayController";

   public static void switchHanderMethod(FullHttpRequest req) {
      String uri = req.uri();
      String content = req.content().toString(CharsetUtil.UTF_8);
      if ("/encryptionGatewayController/receiveAppUserOriginalInfos".equals(uri)) {
         EncryptionGatewayManager.receiveAppUserOriginalInfos(content);
      } else if ("/encryptionGatewayController/receiveGatewayUserOriginalInfos".equals(uri)) {
         EncryptionGatewayManager.receiveGatewayUserOriginalInfos(content);
      } else if ("/encryptionGatewayController/receiveAppUserGlobalOriginalConfig".equals(uri)) {
         EncryptionGatewayManager.receiveGlobalOriginalConfig(content);
      } else if ("/encryptionGatewayController/notifyEngineAndMaskingInfoUri".equals(uri)) {
         EngineUtil.initRule();
      }

   }
}
