/*
 * Copyright (c) 2023 codvision.com All Rights Reserved.
 */

package com.codvision.base.enums;

import com.codvision.commoncore.exception.BusinessException;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 文件存储类型
 *
 * @author lingee
 * @date 2023/8/14
 */
@Getter
@AllArgsConstructor
public enum StorageType {

    /**
     * 本地
     */
    local("0", "2"),
    /**
     * 阿里oss
     */
    oss("1", "1"),
    /**
     * minio
     */
    minio("2", "1");

    private final String type;

    private final String position;

    public static StorageType resolve(String type) {
        for (StorageType value : values()) {
            if (value.type.equals(type)) {
                return value;
            }
        }
        throw new BusinessException(String.format("文件存储类型不存在%s", type));
    }

}
