package com.cusc.nirvana.user.rnr.fp.common.constant;

import com.cusc.nirvana.user.exception.CuscUserException;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;

@AllArgsConstructor
@Getter
public enum FIleSystemType {
    MINIO("minio", "MINIO"),
    OSS("oss", "OSS"),
    ;

    private String code;

    private String descprition;

    public static FIleSystemType getBytype(String code) {
        return Arrays.stream(FIleSystemType.values())
                .filter(businessDetail -> businessDetail.getCode().equals(code))
                .findFirst()
                .orElseThrow(() -> new CuscUserException("", "未查询到对应的文件系统类型:" + code));
    }
}
