package com.storlead.system.enums;

import cn.hutool.core.util.StrUtil;
import lombok.Getter;

import java.util.Objects;

/**
 * @program: sp-sales-platform
 * @description:
 * @author: chenkq
 * @create: 2025-05-08 14:27
 */

@Getter
public enum OrganizationalTypeEnum {
    /**
     * organizationalType（1集团，2公司，3部门，4个人）
     */
    COMPANY_GROUP(1, "集团"),

    SUB_COMPANY_GROUP(2, "分公司"),

    DEPT_GROUP(3, "部门"),

    USER_GROUP(4, "用户"),
    ;

    public Integer code;

    public String desc;

    OrganizationalTypeEnum(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static OrganizationalTypeEnum getEnumByCode(Integer code) {
        if (Objects.isNull(code)) {
            return null;
        }
        for (OrganizationalTypeEnum type : OrganizationalTypeEnum.values()) {
            if (type.code.equals(code)) {
                return type;
            }
        }
        return null;
    }

}
