// Path: src/main/java/org/nextrtc/examples/videochat_with_rest/domain/handler/common/FromMemberHandler.java
// public abstract class FromMemberHandler implements NextRTCHandler {
// 
//     @Override
//     public final void handleEvent(NextRTCEvent event) {
//         event.from().ifPresent(from -> handleEvent(from, event));
//     }
// 
//     protected abstract void handleEvent(NextRTCMember from, NextRTCEvent event);
// }
// 
// Path: src/main/java/org/nextrtc/examples/videochat_with_rest/service/SessionOpenedService.java
// @Service
// @Transactional
// @PreAuthorize(value = "USER")
// public class SessionOpenedService {
// 
//     private static final Logger log = Logger.getLogger(SessionOpenedService.class);
//     @Autowired
//     private MemberRepository memberRepository;
// 
//     @Autowired
//     private AuthUtils authUtils;
// 
//     public void execute(NextRTCMember member) {
//         User user = authUtils.getAuthenticatedUser(member.getSession().getUserPrincipal());
// 
//         createConversationMemberFor(member.getId(), user);
//     }
// 
//     private void createConversationMemberFor(String memberId, User user) {
//         log.info("Created member: " + memberRepository.save(new Member(memberId, user)));
//     }
// 
// }


import org.nextrtc.examples.videochat_with_rest.domain.handler.common.FromMemberHandler;
import org.nextrtc.examples.videochat_with_rest.service.SessionOpenedService;
import org.nextrtc.signalingserver.api.annotation.NextRTCEventListener;
import org.nextrtc.signalingserver.api.dto.NextRTCEvent;
import org.nextrtc.signalingserver.api.dto.NextRTCMember;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import static org.nextrtc.signalingserver.api.NextRTCEvents.SESSION_OPENED;
package org.nextrtc.examples.videochat_with_rest.domain.handler;



@Service
@NextRTCEventListener(SESSION_OPENED)
// Path: src/main/java/org/nextrtc/examples/videochat_with_rest/domain/handler/common/FromMemberHandler.java
// public abstract class FromMemberHandler implements NextRTCHandler {
// 
//     @Override
//     public final void handleEvent(NextRTCEvent event) {
//         event.from().ifPresent(from -> handleEvent(from, event));
//     }
// 
//     protected abstract void handleEvent(NextRTCMember from, NextRTCEvent event);
// }
// 
// Path: src/main/java/org/nextrtc/examples/videochat_with_rest/service/SessionOpenedService.java
// @Service
// @Transactional
// @PreAuthorize(value = "USER")
// public class SessionOpenedService {
// 
//     private static final Logger log = Logger.getLogger(SessionOpenedService.class);
//     @Autowired
//     private MemberRepository memberRepository;
// 
//     @Autowired
//     private AuthUtils authUtils;
// 
//     public void execute(NextRTCMember member) {
//         User user = authUtils.getAuthenticatedUser(member.getSession().getUserPrincipal());
// 
//         createConversationMemberFor(member.getId(), user);
//     }
// 
//     private void createConversationMemberFor(String memberId, User user) {
//         log.info("Created member: " + memberRepository.save(new Member(memberId, user)));
//     }
// 
// }


// Path: src/main/java/org/nextrtc/examples/videochat_with_rest/domain/handler/SessionOpenedHandler.java
import org.nextrtc.examples.videochat_with_rest.domain.handler.common.FromMemberHandler;
import org.nextrtc.examples.videochat_with_rest.service.SessionOpenedService;
import org.nextrtc.signalingserver.api.annotation.NextRTCEventListener;
import org.nextrtc.signalingserver.api.dto.NextRTCEvent;
import org.nextrtc.signalingserver.api.dto.NextRTCMember;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import static org.nextrtc.signalingserver.api.NextRTCEvents.SESSION_OPENED;

package org.nextrtc.examples.videochat_with_rest.domain.handler;



@Service
@NextRTCEventListener(SESSION_OPENED)
public class SessionOpenedHandler extends FromMemberHandler {