package com.ningdatech.carapi.common.constant;

import io.swagger.annotations.ApiModel;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.StringUtils;

import java.util.Objects;

/**
 * @author CMM
 * @description
 * @since 2022/11/23 16:58
 */
@Getter
@AllArgsConstructor
@NoArgsConstructor
@ApiModel("用户角色类型枚举")
public enum  UserRoleTypeEnum {
    /**
     * 系统管理员
     */
    SYSTEM_ADMIN_ROLE_ID("系统管理员",4L),
    SYSTEM_ROLE_ID("系统管理员",25L),
    REGION_ADMIN_ROLE_ID("本区域管理员",24L),
    COMPANY_INFO_OFFICER_ROLE_ID("企业信息员",3L),
    OPERATOR_ROLE_ID("运营商",2L),
    DRIVER_ROLE_ID("驾驶员",11L),
    BULK_CEMENT_ADMIN_ROLE_ID("散办",10L);

    private String desc;
    private Long id;

    public String getDesc() {
        return desc;
    }
    public Long getId() {
        return id;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    public static String getDescById(Long id){
        if (Objects.isNull(id)){
            return StringUtils.EMPTY;
        }
        for (UserRoleTypeEnum u : UserRoleTypeEnum.values()){
            if (id.equals(u.getId())){
                return u.desc;
            }
        }
        return StringUtils.EMPTY;
    }
}

