package com.lesingle.creation.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 举报处理动作枚举
 */
@Getter
@AllArgsConstructor
public enum ReportActionEnum {

    TAKE_DOWN("takedown", "下架"),
    WARN("warn", "警告"),
    BAN("ban", "封禁"),
    IGNORE("ignore", "忽略");

    private final String code;
    private final String desc;

    public static ReportActionEnum getByCode(String code) {
        if (code == null) {
            return IGNORE;
        }
        for (ReportActionEnum action : values()) {
            if (action.getCode().equals(code)) {
                return action;
            }
        }
        return IGNORE;
    }
}
