// Path: src/main/java/com/mpalourdio/springboottemplate/events/AsyncEvent.java
// public class AsyncEvent {
// 
//     public void publishMeLater(String message) {
//         System.out.println(message);
//     }
// }
// 
// Path: src/main/java/com/mpalourdio/springboottemplate/events/AsyncLogger.java
// public class AsyncLogger {
// 
//     private final ApplicationEventPublisher eventPublisher;
// 
//     public AsyncLogger(ApplicationEventPublisher eventPublisher) {
//         this.eventPublisher = eventPublisher;
//     }
// 
//     public void write(Class ownerClass, Level logLevel, String logMessage) {
//         eventPublisher.publishEvent(new LogEvent(ownerClass, logLevel, logMessage));
//     }
// 
//     public static void log(Class ownerClass, Level logLevel, String logMessage) {
//         var logger = LoggerFactory.getLogger(ownerClass);
// 
//         switch (logLevel.levelInt) {
//             case Level.TRACE_INT:
//                 logger.trace(logMessage);
//                 break;
//             case Level.DEBUG_INT:
//                 logger.debug(logMessage);
//                 break;
//             case Level.INFO_INT:
//                 logger.info(logMessage);
//                 break;
//             case Level.WARN_INT:
//                 logger.warn(logMessage);
//                 break;
//             case Level.ERROR_INT:
//                 logger.error(logMessage);
//                 break;
//             default:
//                 logger.info(logMessage);
//                 break;
//         }
//     }
// }
// 
// Path: src/main/java/com/mpalourdio/springboottemplate/events/MyEvent.java
// public class MyEvent {
// 
//     private String message;
// 
//     public MyEvent(String message) {
//         this.message = message;
//     }
// 
//     public String getMessage() {
//         return message;
//     }
// 
//     public void setMessage(String message) {
//         this.message = message;
//     }
// }
// 
// Path: src/main/java/com/mpalourdio/springboottemplate/mediatype/MediaType.java
// public final class MediaType extends org.springframework.http.MediaType {
// 
//     public static final org.springframework.http.MediaType APPLICATION_VND_API_V1;
//     public static final String APPLICATION_VND_API_V1_VALUE = "application/vnd.api.v1+json;charset=UTF-8";
// 
//     public static final org.springframework.http.MediaType APPLICATION_VND_API_V2;
//     public static final String APPLICATION_VND_API_V2_VALUE = "application/vnd.api.v2+json;charset=UTF-8";
// 
//     private MediaType(String type) {
//         super(type);
//     }
// 
//     static {
//         var applicationType = "application";
//         APPLICATION_VND_API_V1 = new org.springframework.http.MediaType(applicationType, "vnd.api.v1+json", StandardCharsets.UTF_8);
//         APPLICATION_VND_API_V2 = new org.springframework.http.MediaType(applicationType, "vnd.api.v2+json", StandardCharsets.UTF_8);
//     }
// }


import ch.qos.logback.classic.Level;
import com.mpalourdio.springboottemplate.events.AsyncEvent;
import com.mpalourdio.springboottemplate.events.AsyncLogger;
import com.mpalourdio.springboottemplate.events.MyEvent;
import com.mpalourdio.springboottemplate.mediatype.MediaType;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/*
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
 * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
 * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
 * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */

package com.mpalourdio.springboottemplate.controllers;


@RestController
@RequestMapping("/event")
public class EventController {

    private final ApplicationEventPublisher eventPublisher;
    private final AsyncLogger logger;

    public EventController(ApplicationEventPublisher eventPublisher, AsyncLogger asyncLogger) {
        this.eventPublisher = eventPublisher;
        logger = asyncLogger;
    }

// Path: src/main/java/com/mpalourdio/springboottemplate/events/AsyncEvent.java
// public class AsyncEvent {
// 
//     public void publishMeLater(String message) {
//         System.out.println(message);
//     }
// }
// 
// Path: src/main/java/com/mpalourdio/springboottemplate/events/AsyncLogger.java
// public class AsyncLogger {
// 
//     private final ApplicationEventPublisher eventPublisher;
// 
//     public AsyncLogger(ApplicationEventPublisher eventPublisher) {
//         this.eventPublisher = eventPublisher;
//     }
// 
//     public void write(Class ownerClass, Level logLevel, String logMessage) {
//         eventPublisher.publishEvent(new LogEvent(ownerClass, logLevel, logMessage));
//     }
// 
//     public static void log(Class ownerClass, Level logLevel, String logMessage) {
//         var logger = LoggerFactory.getLogger(ownerClass);
// 
//         switch (logLevel.levelInt) {
//             case Level.TRACE_INT:
//                 logger.trace(logMessage);
//                 break;
//             case Level.DEBUG_INT:
//                 logger.debug(logMessage);
//                 break;
//             case Level.INFO_INT:
//                 logger.info(logMessage);
//                 break;
//             case Level.WARN_INT:
//                 logger.warn(logMessage);
//                 break;
//             case Level.ERROR_INT:
//                 logger.error(logMessage);
//                 break;
//             default:
//                 logger.info(logMessage);
//                 break;
//         }
//     }
// }
// 
// Path: src/main/java/com/mpalourdio/springboottemplate/events/MyEvent.java
// public class MyEvent {
// 
//     private String message;
// 
//     public MyEvent(String message) {
//         this.message = message;
//     }
// 
//     public String getMessage() {
//         return message;
//     }
// 
//     public void setMessage(String message) {
//         this.message = message;
//     }
// }
// 
// Path: src/main/java/com/mpalourdio/springboottemplate/mediatype/MediaType.java
// public final class MediaType extends org.springframework.http.MediaType {
// 
//     public static final org.springframework.http.MediaType APPLICATION_VND_API_V1;
//     public static final String APPLICATION_VND_API_V1_VALUE = "application/vnd.api.v1+json;charset=UTF-8";
// 
//     public static final org.springframework.http.MediaType APPLICATION_VND_API_V2;
//     public static final String APPLICATION_VND_API_V2_VALUE = "application/vnd.api.v2+json;charset=UTF-8";
// 
//     private MediaType(String type) {
//         super(type);
//     }
// 
//     static {
//         var applicationType = "application";
//         APPLICATION_VND_API_V1 = new org.springframework.http.MediaType(applicationType, "vnd.api.v1+json", StandardCharsets.UTF_8);
//         APPLICATION_VND_API_V2 = new org.springframework.http.MediaType(applicationType, "vnd.api.v2+json", StandardCharsets.UTF_8);
//     }
// }


// Path: src/main/java/com/mpalourdio/springboottemplate/controllers/EventController.java
import ch.qos.logback.classic.Level;
import com.mpalourdio.springboottemplate.events.AsyncEvent;
import com.mpalourdio.springboottemplate.events.AsyncLogger;
import com.mpalourdio.springboottemplate.events.MyEvent;
import com.mpalourdio.springboottemplate.mediatype.MediaType;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/*
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
 * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
 * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
 * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */

package com.mpalourdio.springboottemplate.controllers;


@RestController
@RequestMapping("/event")
public class EventController {

    private final ApplicationEventPublisher eventPublisher;
    private final AsyncLogger logger;

    public EventController(ApplicationEventPublisher eventPublisher, AsyncLogger asyncLogger) {
        this.eventPublisher = eventPublisher;
        logger = asyncLogger;
    }

    @GetMapping(produces = MediaType.TEXT_PLAIN_VALUE)