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

import com.alibaba.fastjson.JSONObject;
import com.jeequan.jeepay.core.constants.CS;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;

/** 自定义模版信息   **/
@Data
public class SmsBizDiyContentModel extends JSONObject {

    public static final String FIELD_LOGIN_NAME = "loginName";
    public static final String FIELD_USER_PWD = "userPwd";

    /** 手机号 **/
    private String phoneNo;

    /** 模版类型 **/
    private String smsBizType;

    /** 构造创建用户信息模版 **/
    public static SmsBizDiyContentModel genUserOpenAccount(String phoneNo, String loginName, String userPwd){

        SmsBizDiyContentModel result = new SmsBizDiyContentModel();

        result.setPhoneNo(phoneNo);
        result.setSmsBizType(CS.SMS_TYPE_API_ENUM.TYPE_ACCOUNT_OPEN); // 商户开户

        result.put(FIELD_LOGIN_NAME, loginName);
        result.put(FIELD_USER_PWD, StringUtils.defaultIfEmpty(userPwd, "默认密码"));
        return result;
    }


    /** 构建通用模板 **/
    public static SmsBizDiyContentModel genModel(String phoneNo, String smsBizType, JSONObject extra){

        SmsBizDiyContentModel result = new SmsBizDiyContentModel();
        result.setPhoneNo(phoneNo);
        result.setSmsBizType(smsBizType);
        result.putAll(extra);
        return result;
    }

}
