package cn.wise.sc.energy.power.plant.business.domain.eum;

/**
 * @description: 趋势图统计方式
 * @author: qh
 * @create: 2020-08-18 15:53
 **/
public enum TendencyStatus {

    YEAR(3, "1y-avg-zero"),
    WEEK(1, "1w-avg-zero"),
    MONTH(2, "1n-avg-zero");
    private Integer code;
    private String downSample;

    TendencyStatus(Integer code, String downSample) {
        this.code = code;
        this.downSample = downSample;
    }

    public Integer getCode() {
        return code;
    }

    public String getDownSample() {
        return downSample;
    }

    public static String getDownSampleByCode(Integer code) {
        TendencyStatus[] values = TendencyStatus.values();
        for (TendencyStatus tendencyStatus : values) {
            if (tendencyStatus.getCode().intValue() == code) {
                return tendencyStatus.getDownSample();
            }
        }
        return TendencyStatus.YEAR.getDownSample();
    }
}
