package cgmblelib.Enum;


import androidx.room.ColumnInfo;

import com.mytatvarnsdk.R;


/**
 * Created by minyuchun on 2019/1/25.
 * enum show trend of glucose
 *
 * @author minyuchun
 */

public enum enumTrend {
    /***
     *  没有趋势
     */
    NONE(10, R.drawable.trend_none, -1, "NONE"),
    /**
     * 快速上升趋势
     */
    RISE_RAPIDLY(2, R.drawable.trend_rise_rapidly, R.drawable.widget_rise_rapid, "SingleUp"),
    /***
     * 中速上升趋势
     */
    RISE_STEADILY(1, R.drawable.trend_rise_steadily, R.drawable.widget_rise_slow, "FortyFiveUp"),
    /***
     * 平稳趋势
     */
    STEADY(0, R.drawable.trend_steady, R.drawable.widget_steady, "Flat"),
    /***
     * 中速下降趋势
     */
    DROP_STEADILY(-1, R.drawable.trend_drop_steadily, R.drawable.widget_drop_slow, "FortyFiveDown"),
    /***
     * 快速下降趋势
     */
    DROP_RAPIDLY(-2, R.drawable.trend_drop_rapidly, R.drawable.widget_drop_rapid, "SingleDown"),
    /**
     * 快速下降趋势 - 且血糖值mm <5
     */
    DROP_RAPIDLY_LOW(-3, R.drawable.trend_drop_rapidly_low, R.drawable.widget_drop_rapid_low, "SingleDown");

    /**
     * 趋势id
     */
    @ColumnInfo(name = "trend")
    private int trendId;
    /**
     * 趋势图片id
     */
    private int drawableId;
    /**
     * 广播发送时候的类型
     */
    private String apsChangeRate;

    private int widgetImg;


    enumTrend(int trendId, int drawableId, int widgetImg, String apsChangeRate) {
        this.trendId = trendId;
        this.drawableId = drawableId;
        this.apsChangeRate = apsChangeRate;
        this.widgetImg = widgetImg;
    }

    public int getTrendId() {
        return trendId;
    }

    public int getDrawableId() {
        return drawableId;
    }

    public int getWidgetImg() {
        return widgetImg;
    }

    public String getApsChangeRate() {
        return apsChangeRate;
    }

    public static enumTrend getEnumTrend(int id) {
        for (enumTrend e : enumTrend.values()) {
            if (id == e.getTrendId()) {
                return e;
            }
        }
        return NONE;
    }

    @Override
    public String toString() {
        return "enumTrend{" +
                "trendId=" + trendId +
                ", drawableId=" + drawableId +
                ", widgetImg=" + widgetImg +
                ", apsChangeRate='" + apsChangeRate + '\'' +
                '}';
    }
}
