package com.tuoheng.miniprogram.enums;

import com.tuoheng.common.core.exception.ServiceException;
import lombok.Getter;
import org.springframework.http.HttpStatus;

/**
 * @Author: 吴彬
 * @CreateTime: 2022-08-31  08:35
 * @Description: 阿里云点播服务 上传状态
 * https://help.aliyun.com/document_detail/56124.html
 * @Version: 1.0
 */
public enum AliyunVodUploadStatusEnum {
    UPLOADING(1,"Uploading", "上传中"),

    UPLOADFAIL(2,"UploadFail", "上传失败"),

    UPLOADSUCC(3,"UploadSucc", "上传完成"),

    TRANSCODING(4,"Transcoding", "转码中"),

    TRANSCODEFAIL(5,"TranscodeFail", "转码失败"),

    CHECKING(6,"Checking","审核中"),

    BLOCKED(7,"Blocked", "屏蔽"),

    NORMAL(8,"Normal", "正常"),

    PRODUCEFAIL(9,"ProduceFail", "合成失败"),
    ;

    AliyunVodUploadStatusEnum(int code, String name, String description){
        this.code = code;
        this.name = name;
        this.description = description;
    }

    @Getter
    private int code;

    @Getter
    private String name;

    @Getter
    private String description;

    public static AliyunVodUploadStatusEnum getByName(String name){
        for (AliyunVodUploadStatusEnum analyseStatusEnum : values()) {
            if(analyseStatusEnum.getName().equals(name)){
                return analyseStatusEnum;
            }
        }
        throw new ServiceException(HttpStatus.BAD_REQUEST.value(), "非法Vod视频上传状态");
    }
}
