package mmo.server;

import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import dagger.Module;
import dagger.Provides;
import io.netty.util.HashedWheelTimer;

import javax.inject.Singleton;

@Module(injects = Server.class)
public class ServerModule {

    @Provides
    @Singleton
    HashedWheelTimer provideHashedWheelTimer() {
        return new HashedWheelTimer();
    }

    @Provides
    @Singleton
    ObjectMapper provideObjectMapper() {
        return new ObjectMapper()
                .setDefaultTyping(
                        new ObjectMapper.DefaultTypeResolverBuilder(
                                ObjectMapper.DefaultTyping
                                        .OBJECT_AND_NON_CONCRETE)
                                .init(
                                        JsonTypeInfo.Id.MINIMAL_CLASS,
                                        null)
                                .inclusion(JsonTypeInfo.As.PROPERTY)
                                .typeProperty("type")
                )
                .enable(SerializationFeature.INDENT_OUTPUT);
    }
}

@@ -1172,16 +1172,83 @@
 _OUTPUT)
+%0A                .disable(SerializationFeature.FAIL_ON_EMPTY_BEANS)
 ;%0A    %7D%0A

fix error on serialization on "empty" message