class ServiceInfoTemplate extends AbstractTemplate<ServiceInfo> {

    @Override
    public ServiceInfo read(Unpacker unpacker, ServiceInfo service, boolean required) throws IOException {
        unpacker.readArrayBegin();
        SocketAddress endpoint = unpacker.read(SocketAddressTemplate.getInstance());
        unpacker.readInt();
        Map<Integer, String> api = unpacker.read(Templates.tMap(Templates.TInteger, Templates.TString));
        unpacker.readArrayEnd();

        return new ServiceInfo(name, endpoint, ServiceApi.of(name, ImmutableBiMap.copyOf(api).inverse()));
    }

    private  ServiceInfoTemplate(String name);

}