// Path: src/main/java/com/wk/lodge/composite/repository/DeviceLimiter.java
// public class DeviceLimiter {
//     private HashMap<String,Integer> maxDevicesPerSession;
//     private float minDistanceThresholdBetweenDevices;
//     private float maxDistanceThresholdBetweenDevices;
// 
//     public DeviceLimiter(HashMap<String,Integer> maxDevicesPerSession, float minDistanceThresholdBetweenDevices, float maxDistanceThresholdBetweenDevices){
//         this.maxDevicesPerSession = maxDevicesPerSession;
//         this.minDistanceThresholdBetweenDevices = minDistanceThresholdBetweenDevices;
//         this.maxDistanceThresholdBetweenDevices = maxDistanceThresholdBetweenDevices;
//     }
//     public HashMap<String,Integer> getMaxDevicesPerSession() {
//         return maxDevicesPerSession;
//     }
//     public float getMinDistanceThresholdBetweenDevices() {
//         return minDistanceThresholdBetweenDevices;
//     }
//     public float getMaxDistanceThresholdBetweenDevices() {
//         return maxDistanceThresholdBetweenDevices;
//     }
// 
//     public int getMaxDevicesPerSessionForGame(String applicationId){
//         return maxDevicesPerSession.get(applicationId);
//     }
// 
// }
// 
// Path: src/main/java/com/wk/lodge/composite/service/RoomService.java
// public class RoomService {
//     private HashMap<String,String[]> roomNames;
//     public RoomService(){}
//     public RoomService(HashMap<String, String[]> roomNames){
//         this.roomNames = roomNames;
//     }
// 
//     public String[] getRoomNamesForApplication(String applicationId){
//         if(roomNames.containsKey(applicationId)){
//             return roomNames.get(applicationId);
//         }
//         else{
//             return null;
//         }
//     }
// }


import com.wk.lodge.composite.repository.DeviceLimiter;
import com.wk.lodge.composite.service.RoomService;
import org.lightcouch.CouchDbClient;
import org.lightcouch.CouchDbProperties;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.ApplicationListener;
import org.springframework.context.annotation.*;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
import org.springframework.core.env.Environment;
import org.springframework.messaging.MessageHandler;
import org.springframework.messaging.SubscribableChannel;
import org.springframework.messaging.simp.annotation.support.SimpAnnotationMethodMessageHandler;
import java.util.HashMap;
import java.util.List;
    getPropertySourcesPlaceholderConfigurer(){
        return new PropertySourcesPlaceholderConfigurer();
    }

    @Bean(destroyMethod = "shutdown")
    public CouchDbClient couchDbSessionClient(){
        CouchDbProperties couchDbProperties = new CouchDbProperties();
        couchDbProperties.setHost(couchDbHostname);
        couchDbProperties.setPort(couchDbHostPort);
        couchDbProperties.setCreateDbIfNotExist(couchDbCreateIfNotExist);
        couchDbProperties.setProtocol(couchDbProtocol);
        couchDbProperties.setMaxConnections(couchDbMaxConnections);
        couchDbProperties.setDbName(sessionDatabaseName);
        couchDbProperties.setUsername(couchDbAdminUser);
        couchDbProperties.setPassword(couchDbAdminPassword);
        return new CouchDbClient(couchDbProperties);
    }

    @Bean
    public DeviceLimiter deviceLimiter(){
        HashMap<String,Integer> maxDevicesPerSession = new HashMap<>();
        maxDevicesPerSession.put(appOneApplicationId, appOneMaxDevicesPerSession);
        maxDevicesPerSession.put(appTwoApplicationId, appTwoMaxDevicesPerSession);
        return new DeviceLimiter(maxDevicesPerSession,minDistanceThresholdBetweenDevices,maxDistanceThresholdBetweenDevices);
    }

    @Bean
    public RoomService roomService(){
        HashMap<String,String[]> roomNames = new HashMap<>();
        roomNames.put(appOneApplicationId, appOneRoomNames);
// Path: src/main/java/com/wk/lodge/composite/repository/DeviceLimiter.java
// public class DeviceLimiter {
//     private HashMap<String,Integer> maxDevicesPerSession;
//     private float minDistanceThresholdBetweenDevices;
//     private float maxDistanceThresholdBetweenDevices;
// 
//     public DeviceLimiter(HashMap<String,Integer> maxDevicesPerSession, float minDistanceThresholdBetweenDevices, float maxDistanceThresholdBetweenDevices){
//         this.maxDevicesPerSession = maxDevicesPerSession;
//         this.minDistanceThresholdBetweenDevices = minDistanceThresholdBetweenDevices;
//         this.maxDistanceThresholdBetweenDevices = maxDistanceThresholdBetweenDevices;
//     }
//     public HashMap<String,Integer> getMaxDevicesPerSession() {
//         return maxDevicesPerSession;
//     }
//     public float getMinDistanceThresholdBetweenDevices() {
//         return minDistanceThresholdBetweenDevices;
//     }
//     public float getMaxDistanceThresholdBetweenDevices() {
//         return maxDistanceThresholdBetweenDevices;
//     }
// 
//     public int getMaxDevicesPerSessionForGame(String applicationId){
//         return maxDevicesPerSession.get(applicationId);
//     }
// 
// }
// 
// Path: src/main/java/com/wk/lodge/composite/service/RoomService.java
// public class RoomService {
//     private HashMap<String,String[]> roomNames;
//     public RoomService(){}
//     public RoomService(HashMap<String, String[]> roomNames){
//         this.roomNames = roomNames;
//     }
// 
//     public String[] getRoomNamesForApplication(String applicationId){
//         if(roomNames.containsKey(applicationId)){
//             return roomNames.get(applicationId);
//         }
//         else{
//             return null;
//         }
//     }
// }


// Path: src/test/java/com/wk/lodge/composite/config/TestRootConfig.java
import com.wk.lodge.composite.repository.DeviceLimiter;
import com.wk.lodge.composite.service.RoomService;
import org.lightcouch.CouchDbClient;
import org.lightcouch.CouchDbProperties;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.ApplicationListener;
import org.springframework.context.annotation.*;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
import org.springframework.core.env.Environment;
import org.springframework.messaging.MessageHandler;
import org.springframework.messaging.SubscribableChannel;
import org.springframework.messaging.simp.annotation.support.SimpAnnotationMethodMessageHandler;
import java.util.HashMap;
import java.util.List;

    getPropertySourcesPlaceholderConfigurer(){
        return new PropertySourcesPlaceholderConfigurer();
    }

    @Bean(destroyMethod = "shutdown")
    public CouchDbClient couchDbSessionClient(){
        CouchDbProperties couchDbProperties = new CouchDbProperties();
        couchDbProperties.setHost(couchDbHostname);
        couchDbProperties.setPort(couchDbHostPort);
        couchDbProperties.setCreateDbIfNotExist(couchDbCreateIfNotExist);
        couchDbProperties.setProtocol(couchDbProtocol);
        couchDbProperties.setMaxConnections(couchDbMaxConnections);
        couchDbProperties.setDbName(sessionDatabaseName);
        couchDbProperties.setUsername(couchDbAdminUser);
        couchDbProperties.setPassword(couchDbAdminPassword);
        return new CouchDbClient(couchDbProperties);
    }

    @Bean
    public DeviceLimiter deviceLimiter(){
        HashMap<String,Integer> maxDevicesPerSession = new HashMap<>();
        maxDevicesPerSession.put(appOneApplicationId, appOneMaxDevicesPerSession);
        maxDevicesPerSession.put(appTwoApplicationId, appTwoMaxDevicesPerSession);
        return new DeviceLimiter(maxDevicesPerSession,minDistanceThresholdBetweenDevices,maxDistanceThresholdBetweenDevices);
    }

    @Bean
    public RoomService roomService(){
        HashMap<String,String[]> roomNames = new HashMap<>();
        roomNames.put(appOneApplicationId, appOneRoomNames);
        return new RoomService(roomNames);