package cn.reghao.oss.common.constant;

import java.util.HashMap;
import java.util.Map;

/**
 * @author reghao
 * @date 2023-05-23 10:43:25
 */
public enum UploadChannel {
    // 网盘上传
    disk(1, "file/"),
    // 视频上传
    video(2, "video/playback/"),
    // 视频封面上传
    cover(3, "image/cover/"),
    // 用户头像上传
    avatar(4, "image/avatar/"),
    // 用户状态照片上传
    photo(5, "image/photo/"),
    // 音频上传
    audio(6, "audio/playback/");

    private final int code;
    private final String prefix;
    UploadChannel(int code, String prefix) {
        this.code = code;
        this.prefix = prefix;
    }

    private static Map<Integer, String> map = new HashMap<>();
    static {
        for (UploadChannel channel : UploadChannel.values()) {
            map.put(channel.code, channel.prefix);
        }
    }

    public static String getPrefix(int code) {
        return map.get(code);
    }

    public int getCode() {
        return code;
    }

    public String getPrefix() {
        return prefix;
    }
}
