package com.ruoyi.excel.wecom.enums;

/**
 * 客户添加来源枚举
 */
public enum AddWayEnum {
    UNKNOWN(0, "未知来源"),
    SCAN_QR_CODE(1, "扫描二维码"),
    SEARCH_MOBILE(2, "搜索手机号"),
    BUSINESS_CARD(3, "名片分享"),
    GROUP_CHAT(4, "群聊"),
    PHONE(5, "手机通讯录"),
    WECHAT_CONTACT(6, "微信联系人"),
    EXTERNAL_SHARE(7, "来自微信的添加好友申请"),
    INTERNAL_SHARE(8, "安装第三方应用时自动添加的客服人员"),
    SEARCH_EMAIL(9, "搜索邮箱"),
    VIDEO_ACCOUNT(10, "视频号添加"),
    CUSTOMER_LINK(16, "通过获客链接添加"),
    INTERNAL_MEMBER_SHARE(201, "内部成员共享"),
    ADMIN_ASSIGN(202, "管理员/负责人分配");

    private final Integer code;
    private final String description;

    AddWayEnum(Integer code, String description) {
        this.code = code;
        this.description = description;
    }

    public Integer getCode() {
        return code;
    }

    public String getDescription() {
        return description;
    }

    /**
     * 根据code获取描述
     *
     * @param code 来源代码
     * @return 来源描述
     */
    public static String getDescriptionByCode(Integer code) {
        if (code == null) {
            return UNKNOWN.getDescription();
        }
        for (AddWayEnum addWay : AddWayEnum.values()) {
            if (addWay.getCode().equals(code)) {
                return addWay.getDescription();
            }
        }
        return UNKNOWN.getDescription();
    }
}
