class LegacySeasonalNaiveDetectorFactoryProvider 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, LegacySeasonalNaiveDetectorParams.class);
        val seasonalNaiveParams = legacyParams.toSeasonalNaiveParams();
        val multiplicativeParams = legacyParams.toMultiplicativeParams();

        val seasonalNaive = new SeasonalNaivePointForecaster(seasonalNaiveParams);
        val multiplicativeIntervalForecaster = new MultiplicativeIntervalForecaster(multiplicativeParams);

        val trusted = document.isTrusted();

        return new ForecastingDetector(uuid, seasonalNaive, multiplicativeIntervalForecaster, type, trusted, "seasonalnaive");
    }

}