package com.tzld.piaoquan.api.common.enums.contentplatform;

import lombok.Getter;

@Getter
public enum UploadVideoAuditStatusEnum {
    WAIT_AUDIT(0, "待审核"),
    AUDITING(1, "审核中"),
    AUDIT_PASS(2, "审核通过"),
    AUDIT_REJECT(3, "审核不通过"),

    other(999, "其他");

    // 状态 0-待审核 1-审核中 2-审核通过 3-审核不通过
    private final int val;
    private final String description;

    UploadVideoAuditStatusEnum(int val, String description) {
        this.val = val;
        this.description = description;
    }

    public static UploadVideoAuditStatusEnum from(int val) {
        for (UploadVideoAuditStatusEnum typeEnum : UploadVideoAuditStatusEnum.values()) {
            if (typeEnum.getVal() == val) {
                return typeEnum;
            }
        }
        return other;
    }

    public static UploadVideoAuditStatusEnum from(String description) {
        for (UploadVideoAuditStatusEnum typeEnum : UploadVideoAuditStatusEnum.values()) {
            if (typeEnum.getDescription().equals(description)) {
                return typeEnum;
            }
        }
        return other;
    }

    public static Integer parsePqAuditStatus(Integer pqAuditStatus) {
        if (pqAuditStatus == null) {
            return AUDITING.getVal();
        }
        switch (pqAuditStatus) {
            case 0:
                return WAIT_AUDIT.getVal();
            case 1:
                return AUDITING.getVal();
            case 2:
                return AUDIT_REJECT.getVal();
            case 3:
                return AUDIT_REJECT.getVal();
            case 4:
                return AUDIT_REJECT.getVal();
            case 5:
                return AUDIT_PASS.getVal();
            default:
                return other.getVal();
        }
    }


}
