class LegacyHoltWintersDetectorFactoryProvider implements DetectorFactoryProvider<ForecastingDetector> {

    @Override
    public ForecastingDetector buildDetector(DetectorDocument document) {
        val uuid = document.getUuid();

        val config = document.getConfig();
        val type = AnomalyType.valueOf((String) config.get("type"));
        val paramsMap = config.get("params");
        val legacyParams = objectMapper.convertValue(paramsMap, LegacyHoltWintersDetectorParams.class);
        val holtWintersParams = legacyParams.toHoltWintersParams();
        val welfordParams = legacyParams.toWelfordParams();

        val holtWinters = new HoltWintersPointForecaster(holtWintersParams);
        val welford = new ExponentialWelfordIntervalForecaster(welfordParams);

        val trusted = document.isTrusted();

        return new ForecastingDetector(uuid, holtWinters, welford, type, trusted, "holtwinters");
    }

}