package org.ddd4j.schema.avro;

import java.io.IOException;

import org.apache.avro.Conversions;
import org.apache.avro.reflect.ReflectData;
import org.ddd4j.contract.Require;
import org.ddd4j.io.Input;
import org.ddd4j.schema.Schema;
import org.ddd4j.schema.SchemaFactory;
import org.ddd4j.value.collection.Configuration;
import org.ddd4j.value.collection.Props;

public class AvroSchemaFactory implements SchemaFactory {

	private final Configuration configuration;
	private final ReflectData data;

	public AvroSchemaFactory() {
		this(Props.EMTPY);
	}

	public AvroSchemaFactory(Configuration configuration) {
		this.configuration = Require.nonNull(configuration);
		this.data = new ReflectData();
		// TODO make configurable?
		data.addLogicalTypeConversion(new Conversions.UUIDConversion());
	}

	@Override
	public <T> Schema<T> createSchema(Class<T> type) {
		return new AvroSchema<>(this, type, data.getSchema(type));
	}

	@Override
	public Schema<?> readSchema(Input input) throws IOException {
		return AvroSchema.deserialize(this, input);
	}

	public ReflectData getData() {
		return data;
	}

	@Override
	public Configuration getConfiguration() {
		return configuration;
	}
}

@@ -196,21 +196,26 @@
 dd4j.io.
-Input
+ReadBuffer
 ;%0D%0Aimpor
@@ -1007,19 +1007,25 @@
 ema(
-Input input
+ReadBuffer buffer
 ) th
@@ -1086,13 +1086,14 @@
 is, 
-input
+buffer
 );%0D%0A

fix compile issue