package com.ilivoo.voom;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.core.convert.ConversionService;

import com.ilivoo.common.socket.exception.SM_Managed_Message;
import com.ilivoo.common.socket.serializing.Serializer;
import com.ilivoo.common.socket.serializing.SerializerHelper;
import com.ilivoo.common.utility.JsonUtils;
import com.ilivoo.voom.model.dynamic.DynamicTest;
import com.ilivoo.voom.model.dynamic.IDynamicTest;
import com.ilivoo.voom.model.test.packet.CM_Message;
import com.ilivoo.voom.model.test.packet.SM_Message;
import com.ilivoo.voom.model.test.packet.SM_Session_Close;
import com.ilivoo.voom.model.test.packet.SM_Session_Connect;
import com.ilivoo.voom.model.testrecache.packet.CM_Create_Player;
import com.ilivoo.voom.model.testrecache.packet.CM_Modify_Player;
import com.ilivoo.voom.model.testrecache.packet.SM_Create_Player;
import com.ilivoo.voom.model.testrecache.packet.SM_Modify_Player;
import com.ilivoo.voom.model.testresouce.manager.ResourceConfig;
import com.ilivoo.voom.model.testresouce.resource.ActiveResource;

public class Debug {
    public static void main(String[] args) {
	ApplicationContext context = new ClassPathXmlApplicationContext("classpath:applicationContext.xml");
	SerializerHelper sh = context.getBean(SerializerHelper.class);
//	Serializer.registerClassForId((short) -1000, CM_Message.class);
//	Serializer.registerClassForId((short) -1001, SM_Message.class);
//	Serializer.registerClassForId((short) -1002, SM_Session_Close.class);
//	Serializer.registerClassForId((short) -1003, SM_Session_Connect.class);
//	Serializer.registerClassForId((short) -1004, SM_Managed_Message.class);
//	Serializer.registerClassForId((short) -1005, CM_Create_Player.class);
//	Serializer.registerClassForId((short) -1006, SM_Create_Player.class);
//	Serializer.registerClassForId((short) -1007, CM_Modify_Player.class);
//	Serializer.registerClassForId((short) -1008, SM_Modify_Player.class);
	IDynamicTest dt = context.getBean(IDynamicTest.class);
	System.out.println(dt);

	ResourceConfig rf = context.getBean(ResourceConfig.class);
	for (ActiveResource ar : rf.activeStorage.getAll()) {
	    System.out.println(ar.getListString());
	    System.out.println(ar.getSetString());
	    System.out.println(ar.getTreeString());
	    System.out.println(ar.getIntMap());
	    System.out.println(ar.getTreeMap());
	    break;
	}
	List<ActiveResource> li = rf.activeStorage.getIndex(ActiveResource.ACTIVE_NAME, "Second_Active_Name");
	System.out.println(li.size());
	System.out.println(rf.value.getValue());
	System.out.println(rf.value2.getValue());
	// System.out.println(context.getBean(ConversionService.class));

	List<String> list = rf.activeCache.getValue().helloList;
	System.out.println(list);
	System.out.println(rf.formula.calculate("hello"));
    }
}
