package com.jeequan.jeepay.core.model.smsconfig;

import com.alibaba.fastjson.JSON;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;

import java.io.Serializable;

/**
 * application.yml 移植到DB中的配置变量 阿里大于短信配置
 **/
@Data
@Slf4j
public class AliyundySmsConfig extends AbstractSmsConfig implements Serializable {

    public static final String endpointName = "cn-hangzhou";

    public static final String regionId = "cn-hangzhou";

    /** 产品名称:云通信短信API产品,开发者无需替换 **/
    public static final String product = "Dysmsapi";

    /** 产品域名,开发者无需替换 **/
    public static final String domain = "dysmsapi.aliyuncs.com";

    public static final byte BIZ_TYPE_REGISTER = 10;


    public static AliyundySmsConfig parse(String val){

        if(StringUtils.isEmpty(val)){
            return null;
        }

        try {
            return JSON.parseObject(val, AliyundySmsConfig.class);
        } catch (Exception e) {
            log.error("【阿里大于短信配置】数据转换异常", e);
            return null;
        }
    }


    /** id **/
    private String accessKeyId;

    /** key **/
    private String accessKeySecret;

    /** 签名串 **/
    private String signName;

    /** 忘记密码模板ID **/
    private String forgetPwdTemplateId;

    /** 商户注册模板ID **/
    private String registerMchTemplateId;

    /** 商户登录模板ID **/
    private String loginMchTemplateId;

    /** 账号开通提醒模板ID **/
    private String accountOpenTemplateId;

    /** 会员手机号绑定模板ID **/
    private String mbrTelBindTemplateId;



}
