// Path: lambda-local/src/main/java/com/zaoo/lambda/LambdaProxyRequestDeserializer.java
// public class LambdaProxyRequestDeserializer implements LambdaRequestDeserializer<LambdaProxyRequest> {
//     private static final String USER_AGENT = "User-Agent";
// 
//     @Override
//     public LambdaProxyRequest serialize(HttpServletRequest req) throws IOException {
//         String requestPath = req.getRequestURI().substring(req.getContextPath().length());
// 
//         LambdaProxyRequest.Identity identity = new LambdaProxyRequest.Identity(req.getRemoteAddr(),
//                 req.getHeader(USER_AGENT));
// 
//         LambdaProxyRequest.RequestContext requestContext = new LambdaProxyRequest.RequestContext(identity,
//                 requestPath,
//                 req.getMethod());
// 
//         return new LambdaProxyRequest(requestPath,
//                 requestPath,
//                 req.getMethod(),
//                 toHeaders(req),
//                 toParameters(req),
//                 requestContext,
//                 readBody(req));
//     }
// 
//     private String readBody(HttpServletRequest req) {
//         try {
//             return IOUtils.toString(req.getReader());
//         } catch (IOException | IllegalStateException e) {
//             return "";
//         }
//     }
// 
//     private Map<String, String> toHeaders(HttpServletRequest req) {
//         Map<String, String> headers = new HashMap<>();
//         for (Enumeration<String> e = req.getHeaderNames(); e.hasMoreElements(); ) {
//             String name = e.nextElement();
//             List<String> values = Collections.list(req.getHeaders(name));
//             headers.put(name, values.get(values.size() - 1));
//         }
//         return headers;
//     }
// 
//     private Map<String, String> toParameters(HttpServletRequest req) {
//         return req.getParameterMap().entrySet().stream()
//                 .collect(Collectors.toMap(Map.Entry::getKey,
//                         entry -> {
//                             String[] values = entry.getValue();
//                             return values[values.length - 1];
//                         }));
//     }
// }
// 
// Path: lambda-local/src/main/java/com/zaoo/lambda/LambdaProxyResponseSerializer.java
// public class LambdaProxyResponseSerializer implements LambdaResponseSerializer<LambdaProxyResponse> {
//     private static final String UTF_8 = "UTF-8";
// 
//     @Override
//     public void deserialize(LambdaProxyResponse output, HttpServletResponse resp) throws IOException {
//         IOUtils.write(output.getBody(), resp.getOutputStream(), UTF_8);
//     }
// }


import com.amazonaws.services.lambda.runtime.Context;
import com.zaoo.lambda.LambdaProxyRequestDeserializer;
import com.zaoo.lambda.LambdaProxyResponseSerializer;
import com.zaoo.lambda.LambdaLocal;
package com.zaoo.lambda.test;


@LambdaLocal(value = {"/testPath2.1", "/testPath2.2"},
        handler = {"com.zaoo.lambda.test.TestFunction2::method1", "com.zaoo.lambda.test.TestFunction2::method2"},
        deserializer = {LambdaProxyRequestDeserializer.class, LambdaProxyRequestDeserializer.class},
// Path: lambda-local/src/main/java/com/zaoo/lambda/LambdaProxyRequestDeserializer.java
// public class LambdaProxyRequestDeserializer implements LambdaRequestDeserializer<LambdaProxyRequest> {
//     private static final String USER_AGENT = "User-Agent";
// 
//     @Override
//     public LambdaProxyRequest serialize(HttpServletRequest req) throws IOException {
//         String requestPath = req.getRequestURI().substring(req.getContextPath().length());
// 
//         LambdaProxyRequest.Identity identity = new LambdaProxyRequest.Identity(req.getRemoteAddr(),
//                 req.getHeader(USER_AGENT));
// 
//         LambdaProxyRequest.RequestContext requestContext = new LambdaProxyRequest.RequestContext(identity,
//                 requestPath,
//                 req.getMethod());
// 
//         return new LambdaProxyRequest(requestPath,
//                 requestPath,
//                 req.getMethod(),
//                 toHeaders(req),
//                 toParameters(req),
//                 requestContext,
//                 readBody(req));
//     }
// 
//     private String readBody(HttpServletRequest req) {
//         try {
//             return IOUtils.toString(req.getReader());
//         } catch (IOException | IllegalStateException e) {
//             return "";
//         }
//     }
// 
//     private Map<String, String> toHeaders(HttpServletRequest req) {
//         Map<String, String> headers = new HashMap<>();
//         for (Enumeration<String> e = req.getHeaderNames(); e.hasMoreElements(); ) {
//             String name = e.nextElement();
//             List<String> values = Collections.list(req.getHeaders(name));
//             headers.put(name, values.get(values.size() - 1));
//         }
//         return headers;
//     }
// 
//     private Map<String, String> toParameters(HttpServletRequest req) {
//         return req.getParameterMap().entrySet().stream()
//                 .collect(Collectors.toMap(Map.Entry::getKey,
//                         entry -> {
//                             String[] values = entry.getValue();
//                             return values[values.length - 1];
//                         }));
//     }
// }
// 
// Path: lambda-local/src/main/java/com/zaoo/lambda/LambdaProxyResponseSerializer.java
// public class LambdaProxyResponseSerializer implements LambdaResponseSerializer<LambdaProxyResponse> {
//     private static final String UTF_8 = "UTF-8";
// 
//     @Override
//     public void deserialize(LambdaProxyResponse output, HttpServletResponse resp) throws IOException {
//         IOUtils.write(output.getBody(), resp.getOutputStream(), UTF_8);
//     }
// }


// Path: lambda-local/src/test/java/com/zaoo/lambda/test/TestFunction2.java
import com.amazonaws.services.lambda.runtime.Context;
import com.zaoo.lambda.LambdaProxyRequestDeserializer;
import com.zaoo.lambda.LambdaProxyResponseSerializer;
import com.zaoo.lambda.LambdaLocal;

package com.zaoo.lambda.test;


@LambdaLocal(value = {"/testPath2.1", "/testPath2.2"},
        handler = {"com.zaoo.lambda.test.TestFunction2::method1", "com.zaoo.lambda.test.TestFunction2::method2"},
        deserializer = {LambdaProxyRequestDeserializer.class, LambdaProxyRequestDeserializer.class},
        serializer = {LambdaProxyResponseSerializer.class, LambdaProxyResponseSerializer.class})