package at.procon.eventhub.tachograph.camel;

import at.procon.eventhub.tachograph.service.TachographActivityEventMapper;
import org.apache.camel.builder.RouteBuilder;
import org.springframework.stereotype.Component;

@Component
public class TachographActivityInputRoute extends RouteBuilder {

    private final TachographActivityEventMapper mapper;

    public TachographActivityInputRoute(TachographActivityEventMapper mapper) {
        this.mapper = mapper;
    }

    @Override
    public void configure() {
        from("direct:tachograph-activity-input")
                .routeId("tachograph-activity-input-route")
                .split(body())
                    .bean(mapper, "map")
                    .to("direct:eventhub-normalized-input")
                .end();
    }
}
