package com.smppw.core.trend;


import com.smppw.common.pojo.enums.TrendType;
import com.smppw.core.trend.calc.*;

import java.util.HashMap;
import java.util.Map;

public class TrendFactory {
    private static TrendFactory instance = new TrendFactory();

    private static Map<TrendType, Trend> trendMap = new HashMap<>();

    private TrendFactory() {

    }

    public static TrendFactory getInstance() {
        return instance;
    }

    public Trend get(TrendType trendType) {
        return trendMap.get(trendType);
    }

    static {
        trendMap.put(TrendType.Nav, new NavTrend());
        trendMap.put(TrendType.OrigNav, new NavTrend());
        trendMap.put(TrendType.Ret, new RetTrend());
        trendMap.put(TrendType.ExtraNav, new ExtraNavTrend());
        trendMap.put(TrendType.ExtraRetAri, new ExtraRetAriTrend());
        trendMap.put(TrendType.ExtraRetGeo, new ExtraRetGeoTrend());
        trendMap.put(TrendType.DrawdownTrend, new DrawdownTrend());
        trendMap.put(TrendType.ExtraDrawdownTrend, new ExtraDrawdownTrend());
        trendMap.put(TrendType.NetValueChange, new NetValueChange());
    }
}
