package com.hzya.frame.dingtalk.enums;

/**
 * @Description 通讯录事件类型
 * @Author xiangerlin
 * @Date 2024/8/27 15:58
 **/
public enum OrgEventEnum {
    USER_ADD_ORG("user_add_org","通讯录用户新增"),
    USER_MODIFY_ORG("user_modify_org","通讯录用户更改"),
    USER_LEAVE_ORG("user_leave_org","通讯录用户离职"),
    USER_ACTIVE_ORG("user_active_org","加入企业后用户激活"),
    ORG_DEPT_CREATE("org_dept_create","通讯录企业部门创建"),
    ORG_DEPT_MODIFY("org_dept_modify","通讯录企业部门更改"),
    ORG_DEPT_REMOVE("org_dept_remove","通讯录企业部门删除"),
    ;


    private String code;
    private String explain;

    OrgEventEnum(String code, String explain) {
        this.code = code;
        this.explain = explain;
    }

    public String getCode() {
        return code;
    }

    public String getExplain() {
        return explain;
    }

    /**
     * 根据code获取事件类型
     * @param code
     * @return
     */
    public static OrgEventEnum getByCode(String code){
        for (OrgEventEnum org : OrgEventEnum.values()) {
            if (org.getCode().equals(code)){
                return org;
            }
        }
        return null;
    }
}
