package cn.iocoder.yudao.framework.sms.core.enums;

import cn.hutool.core.util.ArrayUtil;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 短信渠道枚举
 *
 * @author zzf
 * @date 2021/1/25 10:56
 */
@Getter
@AllArgsConstructor
public enum SmsChannelEnum {

    DEBUG_DING_TALK("DEBUG_DING_TALK", "调试(钉钉)"),
    YUN_PIAN("YUN_PIAN", "云片"),
    ALIYUN("ALIYUN", "阿里云"),
    SENDCHAMP("SENDCHAMP","Sendchamp"),
    YCLOUD("YCLOUD","Ycloud")
//    TENCENT("TENCENT", "腾讯云"),
//    HUA_WEI("HUA_WEI", "华为云"),
    ;

    /**
     * 编码
     */
    private final String code;
    /**
     * 名字
     */
    private final String name;

    public static SmsChannelEnum getByCode(String code) {
        SmsChannelEnum channelEnum = ArrayUtil.firstMatch(o -> o.getCode().equals(code), values());
        if (null == channelEnum) { return DEBUG_DING_TALK; }

        return channelEnum;
    }
}
