package com.qmth.sop.common.enums;

import java.util.Arrays;
import java.util.List;
import java.util.Objects;

/**
 * @Description: 用户来源类型
 * @Param:
 * @return:
 * @Author: wangliang
 * @Date: 2022/4/26
 */
public enum UserSourceEnum {

    ARCHIVES("人员档案", null),

    SYSTEM("系统自带", null),

    ALL("全部", Arrays.asList(4L, 5L, 6L, 7L));

    UserSourceEnum(String title, List<Long> roleIdList) {
        this.title = title;
        this.roleIdList = roleIdList;
    }

    private String title;

    private List<Long> roleIdList;

    public List<Long> getRoleIdList() {
        return roleIdList;
    }

    public void setRoleIdList(List<Long> roleIdList) {
        this.roleIdList = roleIdList;
    }

    public String getTitle() {
        return title;
    }

    /**
     * 状态转换 toName
     *
     * @param value
     * @return
     */
    public static String convertToName(String value) {
        for (UserSourceEnum e : UserSourceEnum.values()) {
            if (Objects.equals(value.trim(), e.getTitle())) {
                return e.name();
            }
        }
        return null;
    }
}
