package com.xinelu.common.enums;

import lombok.Getter;

import java.util.*;

/**
 * @Author mengkuiliang
 * @Description 订阅消息枚举
 * @Date 2023-01-11 17:32
 * @Param
 * @return
 **/
@Getter
public enum MessageTemplateType {

    JTYSXXTZ("1", "家庭医生消息通知", "8InV9jXDT5sMj9OWfXEvlLQGlw2UaWfZ9OBMFxufmfk", "默认通知模版"),

    YYTX_1("9", "用药提醒", "2wn1BssReKjZasxKKZRWxBN0VqSmGmkuhc3AhTr18I0", "提醒居民用药"),

	YYCGTZ("10", "预约成功", "MSSKCxOdtMUkY1ACu-u3itz8Vh_w5xDkO2llAOGwElU", "筛查项目预约成功");


    /**
     * 模版类型
     */
    private final String type;

    /**
     * 标题
     */
    private final String title;
    /**
     * 模版ID
     */
    private final String templateId;
    /**
     * 说明
     */
    private final String description;

    MessageTemplateType(String type,String title, String templateId, String description) {
        this.type = type;
        this.title = title;
        this.templateId = templateId;
        this.description = description;
    }

    public static MessageTemplateType getFolllowupTypeByCode(String type) {
        for (MessageTemplateType templateType : MessageTemplateType.values()) {
            if (type.equals(templateType.getType())) {
                return templateType;
            }
        }
        return MessageTemplateType.JTYSXXTZ;
    }


    /**
     * 获得所有枚举类型到list
     */
    public static List<MessageTemplateType> getAllToList() {
        List<MessageTemplateType> list = new ArrayList<>();
        MessageTemplateType[] values = values();
        Collections.addAll(list, values);
        return list;
    }

    /**
     * 获得所有枚举类型到map
     */
    public static Map<String, MessageTemplateType> getAllToMap() {
        Map<String, MessageTemplateType> map = new HashMap<>();
        for (MessageTemplateType templateType : values()) {
            map.put(templateType.getType(), templateType);
        }
        return map;
    }
}
