package com.dji.sdk.cloudapi.storage;

import com.fasterxml.jackson.annotation.JsonValue;
import io.swagger.v3.oas.annotations.media.Schema;

/**
 * @author sean
 * @version 1.0
 * @date 2022/5/30
 */
@Schema(description = "oss type", example = "minio", enumAsRef = true)
public enum OssTypeEnum {

    ALIYUN("ali"),

    AWS("aws"),

    MINIO("minio"),

    /**
     * VersityGW（S3 兼容）。下发给 Pilot/机场时请映射为 {@link #MINIO} 或 {@link #AWS}。
     */
    VERSITYGW("versity");

    private String type;

    OssTypeEnum(String type) {
        this.type = type;
    }

    @JsonValue
    public String getType() {
        return type;
    }

    /**
     * Pilot / 机场仅识别 ali / aws / minio，VersityGW 对外按 minio 上报。
     */
    public OssTypeEnum toClientProvider() {
        return this == VERSITYGW ? MINIO : this;
    }
}
