package com.ruoyi.ss.record.time.domain.enums;

import com.ruoyi.common.enums.LoginType;
import com.ruoyi.common.exception.ServiceException;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @author wjh
 * 2024/6/6
 */
@Getter
@AllArgsConstructor
public enum OperatorType {

    ADMIN("1", LoginType.ADMIN),
    USER("2", LoginType.FRONT);

    private final String type;
    private final LoginType loginType;

    public static OperatorType parse(LoginType type) {
        for (OperatorType operatorType : values()) {
            if (operatorType.getLoginType().equals(type)) {
                return operatorType;
            }
        }
        throw new ServiceException("不存在该枚举值");
    }

}
